@cogito.ai/astryx-web 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,193 @@
1
+ import { Button } from '@astryxdesign/core/Button'
2
+ import { Divider } from '@astryxdesign/core/Divider'
3
+ import { Heading } from '@astryxdesign/core/Heading'
4
+ import { Icon } from '@astryxdesign/core/Icon'
5
+ import { List, ListItem } from '@astryxdesign/core/List'
6
+ import { MoreMenu } from '@astryxdesign/core/MoreMenu'
7
+ import { Stack } from '@astryxdesign/core/Stack'
8
+ import { Text } from '@astryxdesign/core/Text'
9
+ import { TextInput } from '@astryxdesign/core/TextInput'
10
+ import { useTranslator } from '@astryxdesign/core/i18n'
11
+ import { useState } from 'react'
12
+ import { PageShell, SideDrawer } from '@/components/layout'
13
+ import { useCurrentLocale } from '@/i18n'
14
+
15
+ const SAMPLE_ROWS = [
16
+ {
17
+ id: 'primary',
18
+ titleKey: 'page.__PAGE__.row.primary.title',
19
+ descriptionKey: 'page.__PAGE__.row.primary.description',
20
+ },
21
+ {
22
+ id: 'secondary',
23
+ titleKey: 'page.__PAGE__.row.secondary.title',
24
+ descriptionKey: 'page.__PAGE__.row.secondary.description',
25
+ },
26
+ ] as const
27
+ // Replace with feature data
28
+
29
+ export default function DockWorkbench() {
30
+ const locale = useCurrentLocale()
31
+ const t = useTranslator()
32
+ const [isDrawerOpen, setIsDrawerOpen] = useState(false)
33
+ const [draft, setDraft] = useState('')
34
+
35
+ return (
36
+ <PageShell
37
+ title={t('page.__PAGE__.title')}
38
+ backHref={`/${locale}`}
39
+ backLabel={t('page.__PAGE__.back')}
40
+ actions={
41
+ <Stack direction="horizontal" gap={1} vAlign="center">
42
+ <MoreMenu
43
+ label={t('page.__PAGE__.options')}
44
+ alignment="end"
45
+ items={[
46
+ {
47
+ id: 'reset',
48
+ label: t('page.__PAGE__.reset'),
49
+ icon: <Icon icon="close" size="sm" />,
50
+ onClick: () => setDraft(''),
51
+ },
52
+ ]}
53
+ />
54
+ <Button
55
+ label={t('page.__PAGE__.add')}
56
+ size="sm"
57
+ variant="primary"
58
+ onClick={() => setIsDrawerOpen(true)}
59
+ />
60
+ </Stack>
61
+ }
62
+ >
63
+ <Stack gap={4}>
64
+ <Stack as="section" gap={3}>
65
+ <Stack direction="horizontal" hAlign="between" vAlign="center" gap={2}>
66
+ <Heading level={2}>{t('page.__PAGE__.section.current')}</Heading>
67
+ <Button
68
+ label={t('page.__PAGE__.section.add')}
69
+ size="sm"
70
+ variant="ghost"
71
+ onClick={() => setIsDrawerOpen(true)}
72
+ />
73
+ </Stack>
74
+ <List density="balanced" hasDividers>
75
+ {SAMPLE_ROWS.map((row) => (
76
+ <ListItem
77
+ key={row.id}
78
+ label={t(row.titleKey)}
79
+ description={t(row.descriptionKey)}
80
+ endContent={
81
+ <MoreMenu
82
+ label={t('page.__PAGE__.row.options')}
83
+ size="sm"
84
+ alignment="end"
85
+ presentation="adaptive"
86
+ items={[
87
+ {
88
+ id: 'archive',
89
+ label: t('page.__PAGE__.row.archive'),
90
+ icon: <Icon icon="close" size="sm" />,
91
+ },
92
+ ]}
93
+ />
94
+ }
95
+ />
96
+ ))}
97
+ </List>
98
+ </Stack>
99
+
100
+ <Divider variant="subtle" />
101
+
102
+ <Stack as="section" gap={3}>
103
+ <Stack direction="horizontal" hAlign="between" vAlign="center" gap={2}>
104
+ <Heading level={2}>{t('page.__PAGE__.section.review')}</Heading>
105
+ <Button
106
+ label={t('page.__PAGE__.section.add')}
107
+ size="sm"
108
+ variant="ghost"
109
+ onClick={() => setIsDrawerOpen(true)}
110
+ />
111
+ </Stack>
112
+ <Text type="body" color="secondary">
113
+ {t('page.__PAGE__.section.empty')}
114
+ </Text>
115
+ </Stack>
116
+ </Stack>
117
+
118
+ <SideDrawer
119
+ isOpen={isDrawerOpen}
120
+ onOpenChange={setIsDrawerOpen}
121
+ label={t('page.__PAGE__.drawer.label')}
122
+ header={t('page.__PAGE__.drawer.title')}
123
+ >
124
+ <Stack gap={4}>
125
+ <TextInput
126
+ label={t('page.__PAGE__.field.name')}
127
+ value={draft}
128
+ onChange={setDraft}
129
+ placeholder={t('page.__PAGE__.field.placeholder')}
130
+ isRequired
131
+ />
132
+ <Stack direction="horizontal" hAlign="end">
133
+ <Button
134
+ label={t('page.__PAGE__.drawer.save')}
135
+ variant="primary"
136
+ onClick={() => setIsDrawerOpen(false)}
137
+ />
138
+ </Stack>
139
+ </Stack>
140
+ </SideDrawer>
141
+ </PageShell>
142
+ )
143
+ }
144
+
145
+ /*
146
+ astryx-messages
147
+ {
148
+ "en": {
149
+ "page.__PAGE__.title": "Workspace",
150
+ "page.__PAGE__.back": "Back",
151
+ "page.__PAGE__.options": "Workspace actions",
152
+ "page.__PAGE__.reset": "Clear draft",
153
+ "page.__PAGE__.add": "Add item",
154
+ "page.__PAGE__.section.current": "Current work",
155
+ "page.__PAGE__.section.review": "Needs review",
156
+ "page.__PAGE__.section.add": "Add",
157
+ "page.__PAGE__.section.empty": "Nothing needs review.",
158
+ "page.__PAGE__.row.primary.title": "Prepare release notes",
159
+ "page.__PAGE__.row.primary.description": "Updated today",
160
+ "page.__PAGE__.row.secondary.title": "Review access request",
161
+ "page.__PAGE__.row.secondary.description": "Waiting for a decision",
162
+ "page.__PAGE__.row.options": "Item actions",
163
+ "page.__PAGE__.row.archive": "Archive",
164
+ "page.__PAGE__.drawer.label": "Add a workspace item",
165
+ "page.__PAGE__.drawer.title": "New item",
166
+ "page.__PAGE__.field.name": "Name",
167
+ "page.__PAGE__.field.placeholder": "Describe the work",
168
+ "page.__PAGE__.drawer.save": "Add item"
169
+ },
170
+ "zh-CN": {
171
+ "page.__PAGE__.title": "工作台",
172
+ "page.__PAGE__.back": "返回",
173
+ "page.__PAGE__.options": "工作台操作",
174
+ "page.__PAGE__.reset": "清空草稿",
175
+ "page.__PAGE__.add": "添加事项",
176
+ "page.__PAGE__.section.current": "当前工作",
177
+ "page.__PAGE__.section.review": "待审核",
178
+ "page.__PAGE__.section.add": "添加",
179
+ "page.__PAGE__.section.empty": "没有待审核事项。",
180
+ "page.__PAGE__.row.primary.title": "准备发布说明",
181
+ "page.__PAGE__.row.primary.description": "今天更新",
182
+ "page.__PAGE__.row.secondary.title": "审核访问请求",
183
+ "page.__PAGE__.row.secondary.description": "等待决定",
184
+ "page.__PAGE__.row.options": "事项操作",
185
+ "page.__PAGE__.row.archive": "归档",
186
+ "page.__PAGE__.drawer.label": "添加工作台事项",
187
+ "page.__PAGE__.drawer.title": "新事项",
188
+ "page.__PAGE__.field.name": "名称",
189
+ "page.__PAGE__.field.placeholder": "描述这项工作",
190
+ "page.__PAGE__.drawer.save": "添加事项"
191
+ }
192
+ }
193
+ */