@ossy/storage 1.9.6 → 1.10.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/storage",
3
3
  "description": "Analytics module — workspace analytics for website traffic",
4
- "version": "1.9.6",
4
+ "version": "1.10.0",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "module": "./src/index.js",
@@ -30,5 +30,5 @@
30
30
  "ramda": "*",
31
31
  "react": "*"
32
32
  },
33
- "gitHead": "72d150cf20ff7ba25b328bc5b429b065c2840b2b"
33
+ "gitHead": "d9d31182be64a448d575da432af2830d909ad4b9"
34
34
  }
package/src/Definition.js CHANGED
@@ -2,12 +2,6 @@ export const Definition = {
2
2
  id: 'storage',
3
3
  title: 'Storage',
4
4
  description: 'Storage views and resource browsing inside workspaces.',
5
- module: {
6
- id: 'storage',
7
- enabled: true
8
- },
5
+ icon: 'software-upload',
9
6
  statuses: ['beta'],
10
- actions: ['resources.create-directory', 'resources.move', 'resources.rename', 'resources.remove'],
11
- views: ['home.page', 'resources.list', 'resources.search', 'resources.get'],
12
- tasks: ['resources.upload-named-version']
13
7
  }
@@ -10,7 +10,6 @@ import {
10
10
  import {
11
11
  Overlay,
12
12
  Switch,
13
- Stack,
14
13
  DropZone,
15
14
  Breadcrumbs,
16
15
  Guide,
@@ -23,6 +22,7 @@ import {
23
22
  Title,
24
23
  Tags,
25
24
  EmptyState,
25
+ useLocale,
26
26
  } from '@ossy/design-system'
27
27
  import { useActivePath, ResourcePanel, ResourceList, ResourceDialogMove } from '@ossy/resources'
28
28
  import { useRouter } from '@ossy/router-react'
@@ -49,6 +49,7 @@ const Overlays = {
49
49
 
50
50
  export const ResourcesPage = () => {
51
51
  const router = useRouter()
52
+ const { t } = useLocale()
52
53
  const { workspace } = useWorkspace()
53
54
  const [overlay, setOverlay] = useState(Overlays.None)
54
55
  const [selectedResourceId, setSelectedResourceId] = useState()
@@ -64,7 +65,7 @@ export const ResourcesPage = () => {
64
65
  } = useResources(activePath)
65
66
 
66
67
  const [isCreatingFolder, setIsCreatingFolder] = useState(false)
67
- const [newFolderName, setNewFolderName] = useState('New folder')
68
+ const [newFolderName, setNewFolderName] = useState(() => t('storage.resources.newFolderDefault'))
68
69
 
69
70
  const onCreateFolderSave = (name) => {
70
71
  const folderName = (name || '').trim()
@@ -75,7 +76,7 @@ export const ResourcesPage = () => {
75
76
  createDirectory({ name: folderName, location: activePath })
76
77
  .finally(() => {
77
78
  setIsCreatingFolder(false)
78
- setNewFolderName('New folder')
79
+ setNewFolderName(t('storage.resources.newFolderDefault'))
79
80
  })
80
81
  }
81
82
 
@@ -169,7 +170,7 @@ export const ResourcesPage = () => {
169
170
  event.stopPropagation()
170
171
  onRemoveResource(resource)
171
172
  }}
172
- >Remove
173
+ >{t('storage.resources.contextRemove')}
173
174
  </ContextMenu.Item>
174
175
  ]
175
176
  }
@@ -200,7 +201,7 @@ export const ResourcesPage = () => {
200
201
  }
201
202
  }
202
203
  >
203
- Move
204
+ {t('storage.resources.move')}
204
205
  </ContextMenu.Item>,
205
206
  <ContextMenu.Separator key="separator"></ContextMenu.Separator>,
206
207
  <ContextMenu.Item
@@ -241,18 +242,18 @@ export const ResourcesPage = () => {
241
242
 
242
243
  <View layout="row" inset="m" justifyContent="space-between" alignItems="center" surface="primary" roundness="s" style={{ flexShrink: 0 }}>
243
244
  <View layout='row' gap="s" alignItems="center">
244
- <Title>Storage</Title>
245
+ <Title>{t('storage.resources.title')}</Title>
245
246
 
246
- <Tags size="s" tags={['Beta']} />
247
+ <Tags size="s" tags={[t('storage.resources.beta')]} />
247
248
  </View>
248
249
  </View>
249
250
 
250
- <Stack horizontal gap="xs" style={{ flexGrow: 1 }}>
251
+ <View stack horizontal gap="xs" style={{ flexGrow: 1 }}>
251
252
 
252
- <Stack.Item fill surface="primary" roundness="xs" >
253
- <Stack bordered style={{ height: '100%' }}>
253
+ <View.Item fill surface="primary" roundness="xs" >
254
+ <View stack bordered style={{ height: '100%' }}>
254
255
 
255
- <Stack.Item
256
+ <View.Item
256
257
  data-surface="primary"
257
258
  layout="row"
258
259
  style={{
@@ -279,39 +280,39 @@ export const ResourcesPage = () => {
279
280
  { activePath !== '/' && getActivePath() }
280
281
  </Breadcrumbs>
281
282
 
282
- <Dropdown trigger={<Button prefix="add" variant="command" style={{ height: '32px' }}>Add</Button>}>
283
+ <Dropdown trigger={<Button prefix="add" variant="command" style={{ height: '32px' }}>{t('storage.resources.add')}</Button>}>
283
284
  <View inset="xs" surface="primary" roundness="s">
284
285
  <ContextMenu roundness="s" surface="primary">
285
286
  <ContextMenu.Item
286
287
  prefix="folder-add"
287
288
  onClick={() => {
288
289
  setIsCreatingFolder(true)
289
- setNewFolderName('New folder')
290
+ setNewFolderName(t('storage.resources.newFolderDefault'))
290
291
  }}
291
292
  >
292
- Create folder
293
+ {t('storage.resources.createFolder')}
293
294
  </ContextMenu.Item>
294
295
  <ContextMenu.Item
295
296
  prefix="software-upload"
296
297
  href={router.getHref(`@upload-media?location=${activePath}`)}
297
298
  >
298
- Upload file
299
+ {t('storage.resources.uploadFile')}
299
300
  </ContextMenu.Item>
300
301
  </ContextMenu>
301
302
  </View>
302
303
  </Dropdown>
303
304
 
304
- </Stack.Item>
305
+ </View.Item>
305
306
 
306
- <Stack.Item fill data-scrollbar="hide" style={{ overflowY: 'auto' }}>
307
+ <View.Item fill data-scrollbar="hide" style={{ overflowY: 'auto' }}>
307
308
  <Switch on={resourcesListStatus}>
308
309
 
309
310
  <Switch.Case match={[ResourcesListStatus.Error]}>
310
311
  <View layout="off-center" style={{ height: '100%' }}>
311
312
  <Guide
312
313
  slot="content"
313
- title="Something went wrong"
314
- text="We could not fetch the data to display"
314
+ title={t('storage.resources.errorTitle')}
315
+ text={t('storage.resources.errorText')}
315
316
  style={{ width: '100vw', maxWidth: '350px' }}
316
317
  />
317
318
  </View>
@@ -320,7 +321,7 @@ export const ResourcesPage = () => {
320
321
  <Switch.Case match={[ResourcesListStatus.Loading]}>
321
322
  <DelayedRender>
322
323
  {[1, 2, 3].map(n => (
323
- <Stack.Item key={n}>
324
+ <View.Item key={n}>
324
325
  <div
325
326
  className="inset-m cursor-pointer sans-serif d-flex align-center justify-between"
326
327
  style={{ height: '56px', }}
@@ -345,7 +346,7 @@ export const ResourcesPage = () => {
345
346
  />
346
347
  </div>
347
348
  </div>
348
- </Stack.Item>
349
+ </View.Item>
349
350
  ))}
350
351
  </DelayedRender>
351
352
  </Switch.Case>
@@ -353,7 +354,7 @@ export const ResourcesPage = () => {
353
354
  <Switch.Case match={[ResourcesListStatus.Empty]}>
354
355
  {isCreatingFolder
355
356
  ? <ResourceList resources={[]} inlineFolder={inlineFolder} />
356
- : <EmptyState message="Empty directory" />
357
+ : <EmptyState message={t('storage.resources.emptyDirectory')} />
357
358
  }
358
359
  </Switch.Case>
359
360
 
@@ -362,14 +363,14 @@ export const ResourcesPage = () => {
362
363
  </Switch.Case>
363
364
 
364
365
  </Switch>
365
- </Stack.Item>
366
+ </View.Item>
366
367
 
367
- </Stack>
368
- </Stack.Item>
368
+ </View>
369
+ </View.Item>
369
370
 
370
371
  <ResourcePanel resourceId={selectedResourceId} onClose={() => setSelectedResourceId(undefined)} />
371
372
 
372
- </Stack>
373
+ </View>
373
374
 
374
375
 
375
376
  {
@@ -380,11 +381,11 @@ export const ResourcesPage = () => {
380
381
  <View surface="primary" roundness="s">
381
382
  <View surface="primary" inset="l" roundness="s">
382
383
  <Guide
383
- title="Remove directory"
384
- text="Are you sure you want to remove this directory and everything in it?"
384
+ title={t('storage.resources.removeDirectoryTitle')}
385
+ text={t('storage.resources.removeDirectoryText')}
385
386
  actions={[
386
- { label: 'Cancel', variant: "command", onClick: () => setOverlay(Overlays.None) },
387
- { label: 'Remove', variant: 'command-danger', onClick: () => {
387
+ { label: t('storage.resources.cancel'), variant: "command", onClick: () => setOverlay(Overlays.None) },
388
+ { label: t('storage.resources.remove'), variant: 'command-danger', onClick: () => {
388
389
  removeResource(selectedResourceId)
389
390
  setOverlay(Overlays.None)
390
391
  }}
@@ -3,7 +3,7 @@ import {
3
3
  Title,
4
4
  Text,
5
5
  View,
6
- Icon2,
6
+ Icon,
7
7
  PageSection,
8
8
  MarkdownViewer
9
9
  } from '@ossy/design-system'
@@ -40,7 +40,7 @@ export default ({
40
40
  }}
41
41
  >
42
42
  <View justifyContent="center" alignItems="center">
43
- <Icon2 name={x.icon} size="m" />
43
+ <Icon name={x.icon} size="m" />
44
44
  </View>
45
45
  <Text variant="small" style={{ fontWeight: 'bold', textAlign: 'center' }}>{x.title}</Text>
46
46
  <Text variant="small" style={{ textAlign: 'center' }}>{x.text}</Text>
@@ -62,7 +62,7 @@ export default ({
62
62
 
63
63
  <View layout="row" gap="s" alignItems="center">
64
64
  <View justifyContent="center" alignItems="center">
65
- <Icon2 name={x.icon} size="m" />
65
+ <Icon name={x.icon} size="m" />
66
66
  </View>
67
67
  <Title variant="tertiary">
68
68
  {x.title}
@@ -0,0 +1,20 @@
1
+ {
2
+ "storage.home.documentTitle": "Storage – Ossy",
3
+ "storage.home.cover.title": "Storage",
4
+ "storage.home.cover.text": "Managing content should be easy",
5
+ "storage.resources.title": "Storage",
6
+ "storage.resources.beta": "Beta",
7
+ "storage.resources.add": "Add",
8
+ "storage.resources.createFolder": "Create folder",
9
+ "storage.resources.uploadFile": "Upload file",
10
+ "storage.resources.newFolderDefault": "New folder",
11
+ "storage.resources.errorTitle": "Something went wrong",
12
+ "storage.resources.errorText": "We could not fetch the data to display",
13
+ "storage.resources.emptyDirectory": "Empty directory",
14
+ "storage.resources.removeDirectoryTitle": "Remove directory",
15
+ "storage.resources.removeDirectoryText": "Are you sure you want to remove this directory and everything in it?",
16
+ "storage.resources.cancel": "Cancel",
17
+ "storage.resources.remove": "Remove",
18
+ "storage.resources.move": "Move",
19
+ "storage.resources.contextRemove": "Remove"
20
+ }
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
+ import { useLocale } from '@ossy/design-system'
2
3
  import { ResourcesPage } from './ResourcesPage.jsx'
3
4
  import { useApp } from '@ossy/app/shell'
4
- import { cover } from './cover.js'
5
5
  import { features } from './features.js'
6
6
  import SalesSection from './SalesSection.jsx'
7
7
 
@@ -13,7 +13,17 @@ export const metadata = {
13
13
  },
14
14
  }
15
15
 
16
- export default () => {
17
- const app = useApp()
18
- return app?.isAuthenticated ? <ResourcesPage /> : <SalesSection cover={cover} features={features} />
16
+ function StorageSalesSection () {
17
+ const { t } = useLocale()
18
+ const cover = {
19
+ title: t('storage.home.cover.title'),
20
+ titleVariant: 'primary',
21
+ text: t('storage.home.cover.text'),
22
+ }
23
+ return <SalesSection cover={cover} features={features} />
24
+ }
25
+
26
+ export default function StorageHomePage () {
27
+ const app = useApp()
28
+ return app?.isAuthenticated ? <ResourcesPage /> : <StorageSalesSection />
19
29
  }
@@ -0,0 +1,20 @@
1
+ {
2
+ "storage.home.documentTitle": "Storage",
3
+ "storage.home.cover.title": "Storage",
4
+ "storage.home.cover.text": "Det ska vara enkelt att hantera innehåll",
5
+ "storage.resources.title": "Storage",
6
+ "storage.resources.beta": "Beta",
7
+ "storage.resources.add": "Lägg till",
8
+ "storage.resources.createFolder": "Skapa mapp",
9
+ "storage.resources.uploadFile": "Ladda upp fil",
10
+ "storage.resources.newFolderDefault": "Ny mapp",
11
+ "storage.resources.errorTitle": "Något gick fel",
12
+ "storage.resources.errorText": "Vi kunde inte hämta data att visa",
13
+ "storage.resources.emptyDirectory": "Tom katalog",
14
+ "storage.resources.removeDirectoryTitle": "Ta bort mapp",
15
+ "storage.resources.removeDirectoryText": "Är du säker på att du vill ta bort den här mappen och allt innehåll?",
16
+ "storage.resources.cancel": "Avbryt",
17
+ "storage.resources.remove": "Ta bort",
18
+ "storage.resources.move": "Flytta",
19
+ "storage.resources.contextRemove": "Ta bort"
20
+ }