Skip to content

Commit a2e7559

Browse files
committed
linked better ui
1 parent 855a671 commit a2e7559

File tree

2 files changed

+33
-36
lines changed

2 files changed

+33
-36
lines changed

cms/Components/MainMenu/index.tsx

-11
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,13 @@ export const MainMenu = () => {
3030
.filter((key) => key !== 'user')
3131
.filter((key) => key !== 'file')
3232
.map((key) => {
33-
// if (schemaTypes[key].parents) {
34-
// menuItems[schemaTypes[key].parents][key] = [
35-
// {
36-
// value: key,
37-
// label: schemaTypes[key]?.meta?.displayName || key,
38-
// },
39-
// ]
40-
// } else {
4133
menuItems[key] = {
4234
value: key,
4335
label: schemaTypes[key]?.meta?.displayName || key,
4436
}
45-
// }
4637
})
4738
}
4839

49-
console.log(menuItems)
50-
5140
const [active, setActive] = React.useState(section as string)
5241

5342
return (

cms/Content/ContentEditor.tsx

+33-25
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
import React, { useState } from 'react'
22
import { styled } from 'inlines'
33
import { useClient, useQuery } from '@based/react'
4-
import {
5-
Text,
6-
Badge,
7-
Row,
8-
FormGroup,
9-
IconArrowLeft,
10-
color,
11-
ScrollArea,
12-
} from '@based/ui'
4+
import { color, ScrollArea } from '@based/ui'
135
import { PublishSideBar } from './PublishSideBar'
146
import { useRoute } from 'kabouter'
7+
import { Text, Badge, Stack, IconArrowLeft, Form } from 'better-ui'
158

169
const FILTER_FIELDS = [
1710
'type',
@@ -43,8 +36,6 @@ export const ContentEditor = ({ id, section }) => {
4336

4437
const { data: schema, loading: loadingSchema } = useQuery('db:schema')
4538

46-
// console.log(data, '🐸', userData)
47-
4839
const route = useRoute('[section][id]')
4940

5041
// filter out some system fields
@@ -58,8 +49,6 @@ export const ContentEditor = ({ id, section }) => {
5849
}
5950
}
6051

61-
// console.log('schema fields', schemaFields)
62-
6352
return (
6453
<styled.div
6554
style={{
@@ -69,7 +58,7 @@ export const ContentEditor = ({ id, section }) => {
6958
}}
7059
>
7160
<ScrollArea style={{ padding: '24px 48px', width: '100%' }}>
72-
<Row
61+
<Stack
7362
style={{
7463
cursor: 'pointer',
7564
marginBottom: 6,
@@ -84,24 +73,40 @@ export const ContentEditor = ({ id, section }) => {
8473
setSomeThingChanged(false)
8574
}}
8675
>
87-
<IconArrowLeft style={{ marginRight: 8 }} />
88-
<Text weight="medium">Back</Text>
89-
</Row>
90-
<Row style={{ marginBottom: 32 }}>
91-
<Text weight="strong" size={24} style={{ marginRight: 12 }}>
76+
<IconArrowLeft />
77+
<Text variant="bodyBold">Back</Text>
78+
</Stack>
79+
<Stack style={{ marginBottom: 32 }}>
80+
<Text
81+
variant="bodyStrong"
82+
as="h3"
83+
style={{ marginRight: 12, fontSize: 24 }}
84+
>
9285
{section}
9386
</Text>
94-
<Badge light>{id}</Badge>
95-
</Row>
87+
<Badge color="auto-muted" copyValue={id}>
88+
{id}
89+
</Badge>
90+
</Stack>
9691
{schema && (
97-
<FormGroup
98-
alwaysAccept
99-
config={filteredSchemaFields}
92+
// <FormGroup
93+
// alwaysAccept
94+
// config={filteredSchemaFields}
95+
// onChange={(v) => {
96+
// setSomeThingChanged(true)
97+
// setFormFieldChanges({ ...formFieldChanges, ...v })
98+
// }}
99+
// values={{ ...data, ...formFieldChanges }}
100+
// />
101+
102+
<Form
103+
values={{ ...data, ...formFieldChanges }}
104+
fields={schemaFields}
100105
onChange={(v) => {
106+
console.log(v, '🐋')
101107
setSomeThingChanged(true)
102108
setFormFieldChanges({ ...formFieldChanges, ...v })
103109
}}
104-
values={{ ...data, ...formFieldChanges }}
105110
/>
106111
)}
107112
</ScrollArea>
@@ -116,6 +121,9 @@ export const ContentEditor = ({ id, section }) => {
116121
// ...formFieldChanges,
117122
// updatedBy: userData.name,
118123
// })
124+
125+
// TODO updatedBy can be meta data from updatedAt @yves
126+
119127
if (Object.keys(schemaFields).includes('updatedBy')) {
120128
await client
121129
.call('db:set', {

0 commit comments

Comments
 (0)