|
1 | 1 | <script lang="ts"> |
2 | | - import * as RadioGroup from '$lib/components/ui/radio-group'; |
3 | | - import { t } from 'svelte-i18n-lingui'; |
4 | | - import { views } from '$lib/views/view-data'; |
5 | | - import { useCurrentView } from '$lib/views/view-service'; |
6 | | - import Switch from '$lib/components/ui/switch/switch.svelte'; |
7 | | - import ResponsivePopup from '$lib/components/responsive-popup/responsive-popup.svelte'; |
8 | | - import {Button} from '$lib/components/ui/button'; |
9 | | - import DevContent from '$lib/layout/DevContent.svelte'; |
10 | 2 | import * as Popover from '$lib/components/ui/popover'; |
11 | | - import Markdown from 'svelte-exmarkdown'; |
| 3 | + import * as RadioGroup from '$lib/components/ui/radio-group'; |
12 | 4 | import NewTabLinKMarkdown from '$lib/markdown/NewTabLinKMarkdown.svelte'; |
13 | 5 | import {delay} from '$lib/utils/time'; |
| 6 | + import {views} from '$lib/views/view-data'; |
| 7 | + import {useCurrentView} from '$lib/views/view-service'; |
| 8 | + import Markdown from 'svelte-exmarkdown'; |
| 9 | + import {t} from 'svelte-i18n-lingui'; |
14 | 10 |
|
15 | | - let { |
16 | | - dictionaryPreview = $bindable('show'), |
17 | | - readonly = $bindable(false), |
18 | | - }: { |
19 | | - dictionaryPreview?: 'show' | 'hide' | 'sticky' |
20 | | - readonly?: boolean |
21 | | - } = $props(); |
22 | 11 | const currentView = useCurrentView(); |
23 | 12 | function getCurrentView() { |
24 | 13 | return $currentView.id; |
|
36 | 25 | } |
37 | 26 | } |
38 | 27 | </script> |
39 | | -<ResponsivePopup title={$t`View Configuration`}> |
40 | | - {#snippet trigger({props})} |
41 | | - <Button {...props} size="icon" variant="ghost" icon="i-mdi-layers" /> |
42 | | - {/snippet} |
43 | | - <div class="space-y-2 md:space-y-4"> |
44 | | - <RadioGroup.Root bind:value={getCurrentView, setCurrentView}> |
45 | | - <Popover.Root onOpenChange={onPopoverOpenChange}> |
46 | | - <Popover.InfoTrigger class="text-start w-fit"> |
47 | | - <h3 class="inline font-normal max-md:mb-1">{$t`View`}</h3> |
48 | | - </Popover.InfoTrigger> |
49 | | - <Popover.Content bind:ref={popoverContent} class="max-h-[40vh] overflow-y-auto text-sm flex flex-col gap-2"> |
50 | | - <div> |
51 | | - <Markdown md={$t`The *FieldWorks Lite* view is designed for non-linguists and differs from the *FieldWorks Classic* view in the following ways:`} /> |
52 | | - <ul class="text-sm pl-4 list-disc mt-0.5 [&_strong]:font-semibold"> |
53 | | - <li><Markdown md={$t`**Simpler terminology** (e.g. *Word* instead of *Lexeme form*, *Meaning* instead of *Sense*)`} /></li> |
54 | | - <li><Markdown md={$t`**Fewer fields** (e.g. hides *Complex form types*, *Literal meaning*)`} /></li> |
55 | | - <li><Markdown md={$t`**Fewer morpheme types** (only *Root*, *Bound Root*, *Stem*, *Bound Stem*, *Particle*, *Phrase*, and *Discontiguous Phrase*)`} /></li> |
56 | | - </ul> |
57 | | - </div> |
58 | | - <NewTabLinKMarkdown md={$t`The *FieldWorks Classic* view, on the other hand, is designed for users who are familiar with *[FieldWorks Language Explorer](https://software.sil.org/fieldworks/)*.`} /> |
59 | | - </Popover.Content> |
60 | | - </Popover.Root> |
61 | | - {#each views as view (view.id)} |
62 | | - <RadioGroup.Item value={view.id} label={view.label} /> |
63 | | - {/each} |
64 | | - </RadioGroup.Root> |
65 | | - <RadioGroup.Root bind:value={dictionaryPreview}> |
66 | | - <h3 class="font-normal max-md:mb-1">{$t`Dictionary Preview`}</h3> |
67 | | - <RadioGroup.Item value="show" label={$t`Show`} /> |
68 | | - <RadioGroup.Item value="hide" label={$t`Hide`}/> |
69 | | - <RadioGroup.Item value="sticky" label={$t`Pinned`}/> |
70 | | - </RadioGroup.Root> |
71 | | - <DevContent> |
72 | | - <div class="space-y-2"> |
73 | | - <h3 class="font-normal">Dev Options</h3> |
74 | | - <div class="flex items-center space-x-2"> |
75 | | - <Switch bind:checked={readonly} label="Readonly" /> |
76 | | - </div> |
| 28 | +<RadioGroup.Root bind:value={getCurrentView, setCurrentView}> |
| 29 | + <Popover.Root onOpenChange={onPopoverOpenChange}> |
| 30 | + <Popover.InfoTrigger class="text-start w-fit"> |
| 31 | + <h3 class="inline font-normal max-md:mb-1">{$t`View`}</h3> |
| 32 | + </Popover.InfoTrigger> |
| 33 | + <Popover.Content bind:ref={popoverContent} class="max-h-[40vh] overflow-y-auto text-sm flex flex-col gap-2"> |
| 34 | + <div> |
| 35 | + <Markdown md={$t`The *FieldWorks Lite* view is designed for non-linguists and differs from the *FieldWorks Classic* view in the following ways:`} /> |
| 36 | + <ul class="text-sm pl-4 list-disc mt-0.5 [&_strong]:font-semibold"> |
| 37 | + <li><Markdown md={$t`**Simpler terminology** (e.g. *Word* instead of *Lexeme form*, *Meaning* instead of *Sense*)`} /></li> |
| 38 | + <li><Markdown md={$t`**Fewer fields** (e.g. hides *Complex form types*, *Literal meaning*)`} /></li> |
| 39 | + <li><Markdown md={$t`**Fewer morpheme types** (only *Root*, *Bound Root*, *Stem*, *Bound Stem*, *Particle*, *Phrase*, and *Discontiguous Phrase*)`} /></li> |
| 40 | + </ul> |
77 | 41 | </div> |
78 | | - </DevContent> |
79 | | - </div> |
80 | | -</ResponsivePopup> |
| 42 | + <NewTabLinKMarkdown md={$t`The *FieldWorks Classic* view, on the other hand, is designed for users who are familiar with *[FieldWorks Language Explorer](https://software.sil.org/fieldworks/)*.`} /> |
| 43 | + </Popover.Content> |
| 44 | + </Popover.Root> |
| 45 | + {#each views as view (view.id)} |
| 46 | + <RadioGroup.Item value={view.id} label={view.label} /> |
| 47 | + {/each} |
| 48 | +</RadioGroup.Root> |
0 commit comments