From d1585f8ab2e159988cd290b5f170f070b2a8040a Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 13 Jan 2025 13:36:43 +0700 Subject: [PATCH 1/7] make activity changes textbox readonly --- frontend/viewer/src/app.postcss | 17 +++++++++++++++++ .../viewer/src/lib/activity/ActivityView.svelte | 3 ++- .../viewer/src/lib/history/HistoryView.svelte | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/frontend/viewer/src/app.postcss b/frontend/viewer/src/app.postcss index cc9ca7abb..c07c20a93 100644 --- a/frontend/viewer/src/app.postcss +++ b/frontend/viewer/src/app.postcss @@ -112,3 +112,20 @@ .AppBar :has(> [slot="actions"]) { flex-grow: 0; } + +/* the input must also be disabled, otherwise it will be editable*/ +.input-readonly { + &.TextField, .TextField { + opacity: 1; + + input, textarea { + /* enable standard text selection */ + pointer-events: auto; + cursor: text; + } + + .append { + display: none; + } + } +} diff --git a/frontend/viewer/src/lib/activity/ActivityView.svelte b/frontend/viewer/src/lib/activity/ActivityView.svelte index 23878d78e..599e3e395 100644 --- a/frontend/viewer/src/lib/activity/ActivityView.svelte +++ b/frontend/viewer/src/lib/activity/ActivityView.svelte @@ -86,8 +86,9 @@ {#if selectedRow} {/if} diff --git a/frontend/viewer/src/lib/history/HistoryView.svelte b/frontend/viewer/src/lib/history/HistoryView.svelte index 3a269ab3f..d1a4a7abc 100644 --- a/frontend/viewer/src/lib/history/HistoryView.svelte +++ b/frontend/viewer/src/lib/history/HistoryView.svelte @@ -70,14 +70,14 @@
{#if record?.entity} {#if record.entityName === 'Entry'} - + {:else if record.entityName === 'Sense'}
- +
{:else if record.entityName === 'ExampleSentence'}
- +
{/if} {/if} From 0b3673b3a8f1784d6f97f87af7c04aa23bd3fd0d Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Mon, 13 Jan 2025 16:59:53 +0700 Subject: [PATCH 2/7] show border on readonly fields --- frontend/viewer/src/lib/entry-editor/field.postcss | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/viewer/src/lib/entry-editor/field.postcss b/frontend/viewer/src/lib/entry-editor/field.postcss index bcd54ae8f..eec054b2e 100644 --- a/frontend/viewer/src/lib/entry-editor/field.postcss +++ b/frontend/viewer/src/lib/entry-editor/field.postcss @@ -28,10 +28,6 @@ &.TextField, .TextField { opacity: 1; - [class~="border"] { - border: none; - } - input { /* enable standard text selection */ pointer-events: auto; From 115b10aceafcaeff0393596685241fb88a6c0056 Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Mon, 13 Jan 2025 15:46:30 +0100 Subject: [PATCH 3/7] Fix test-project --- frontend/viewer/src/TestProjectView.svelte | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/viewer/src/TestProjectView.svelte b/frontend/viewer/src/TestProjectView.svelte index 4d8cb1a83..ca403ffe4 100644 --- a/frontend/viewer/src/TestProjectView.svelte +++ b/frontend/viewer/src/TestProjectView.svelte @@ -2,8 +2,15 @@ import ProjectView from './ProjectView.svelte'; import {InMemoryApiService} from '$lib/in-memory-api-service'; import {DotnetService} from '$lib/dotnet-types'; +import {FwLitePlatform} from '$lib/dotnet-types/generated-types/FwLiteShared/FwLitePlatform'; const inMemoryLexboxApi = new InMemoryApiService(); window.lexbox.ServiceProvider.setService(DotnetService.MiniLcmApi, inMemoryLexboxApi); +window.lexbox.ServiceProvider.setService(DotnetService.FwLiteConfig, { + appVersion: 'test-project', + feedbackUrl: '', + os: FwLitePlatform.Web, + useDevAssets: true, +}); From 3ba1768192d31c08a476604bc415af18ebb3d897 Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Mon, 13 Jan 2025 15:47:20 +0100 Subject: [PATCH 4/7] Rework hiding search icon in readonly mode --- frontend/viewer/src/lib/entry-editor/field.postcss | 5 ++--- .../src/lib/entry-editor/inputs/CrdtMultiOptionField.svelte | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/viewer/src/lib/entry-editor/field.postcss b/frontend/viewer/src/lib/entry-editor/field.postcss index eec054b2e..5085980d7 100644 --- a/frontend/viewer/src/lib/entry-editor/field.postcss +++ b/frontend/viewer/src/lib/entry-editor/field.postcss @@ -34,9 +34,8 @@ cursor: text; } - .append { - display: none; - } + .append, .prepend { + display: none; } } diff --git a/frontend/viewer/src/lib/entry-editor/inputs/CrdtMultiOptionField.svelte b/frontend/viewer/src/lib/entry-editor/inputs/CrdtMultiOptionField.svelte index bfd640d16..089c55cf5 100644 --- a/frontend/viewer/src/lib/entry-editor/inputs/CrdtMultiOptionField.svelte +++ b/frontend/viewer/src/lib/entry-editor/inputs/CrdtMultiOptionField.svelte @@ -43,7 +43,7 @@ value={editorValue} disabled={readonly} options={sortedOptions} - icon={readonly ? undefined : mdiMagnify} + icon={mdiMagnify} formatSelected={({ value, options }) => { return (preserveOrder // sorted by order of selection From 8c0f605d46a4e932acf7007dbf8f1a01140aae34 Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Mon, 13 Jan 2025 15:47:49 +0100 Subject: [PATCH 5/7] Restyle readonly vs editable state of form fields --- frontend/viewer/src/app.postcss | 17 ---------- .../src/lib/activity/ActivityView.svelte | 2 +- .../viewer/src/lib/entry-editor/field.postcss | 33 ++++++++++++++----- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/frontend/viewer/src/app.postcss b/frontend/viewer/src/app.postcss index c07c20a93..cc9ca7abb 100644 --- a/frontend/viewer/src/app.postcss +++ b/frontend/viewer/src/app.postcss @@ -112,20 +112,3 @@ .AppBar :has(> [slot="actions"]) { flex-grow: 0; } - -/* the input must also be disabled, otherwise it will be editable*/ -.input-readonly { - &.TextField, .TextField { - opacity: 1; - - input, textarea { - /* enable standard text selection */ - pointer-events: auto; - cursor: text; - } - - .append { - display: none; - } - } -} diff --git a/frontend/viewer/src/lib/activity/ActivityView.svelte b/frontend/viewer/src/lib/activity/ActivityView.svelte index 599e3e395..953d71e03 100644 --- a/frontend/viewer/src/lib/activity/ActivityView.svelte +++ b/frontend/viewer/src/lib/activity/ActivityView.svelte @@ -88,7 +88,7 @@ value={JSON.stringify(selectedRow.changes, null, 4)} disabled multiline - class="input-readonly" + class="readonly field" classes={{input: 'h-80'}}/> {/if}
diff --git a/frontend/viewer/src/lib/entry-editor/field.postcss b/frontend/viewer/src/lib/entry-editor/field.postcss index 5085980d7..01e791c23 100644 --- a/frontend/viewer/src/lib/entry-editor/field.postcss +++ b/frontend/viewer/src/lib/entry-editor/field.postcss @@ -24,15 +24,30 @@ @apply col-span-2 pl-4; } - .readonly { - &.TextField, .TextField { - opacity: 1; - - input { - /* enable standard text selection */ - pointer-events: auto; - cursor: text; - } + &.TextField, .TextField { + [class~="border"] { + filter: contrast(0.95); + border-radius: 0; + border-style: none; + border-bottom-style: solid; + @apply !shadow-none; + border-color: hsl(var(--color-surface-content) / 30%); + } + } + + &.readonly.TextField, .readonly.TextField, .readonly .TextField { + /* prevent other "disabled-state styles" from impacting readability */ + opacity: 1; + + [class~="border"] { + border-color: hsl(var(--color-surface-content) / 20%); + background: transparent; + } + + input { + /* enable standard text selection */ + pointer-events: auto; + } .append, .prepend { display: none; From d61a0af609a4283ae2b391ee54f414ad066bbdfc Mon Sep 17 00:00:00 2001 From: Tim Haasdyk Date: Mon, 13 Jan 2025 15:48:01 +0100 Subject: [PATCH 6/7] Add forgotten generated code --- .../generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts b/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts index 3a80ba807..2933e57b9 100644 --- a/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts +++ b/frontend/viewer/src/lib/dotnet-types/generated-types/FwLiteShared/Services/IMiniLcmJsInvokable.ts @@ -57,6 +57,5 @@ export interface IMiniLcmJsInvokable createExampleSentence(entryId: string, senseId: string, exampleSentence: IExampleSentence) : Promise; updateExampleSentence(entryId: string, senseId: string, before: IExampleSentence, after: IExampleSentence) : Promise; deleteExampleSentence(entryId: string, senseId: string, exampleSentenceId: string) : Promise; - dispose() : Promise; } /* eslint-enable */ From c25bd3c3b19e561a7324c3dc2677ba239654b174 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 14 Jan 2025 09:17:47 +0700 Subject: [PATCH 7/7] ensure FwLiteConfig is defined for viewer --- frontend/viewer/src/ProjectView.svelte | 2 +- frontend/viewer/src/WebComponent.svelte | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/viewer/src/ProjectView.svelte b/frontend/viewer/src/ProjectView.svelte index af05d74b9..014729e48 100644 --- a/frontend/viewer/src/ProjectView.svelte +++ b/frontend/viewer/src/ProjectView.svelte @@ -344,7 +344,7 @@ {#if about} {/if} - {#if $features.feedback} + {#if $features.feedback && fwLiteConfig.feedbackUrl}