Skip to content

Commit

Permalink
make activity changes textbox readonly (#1370)
Browse files Browse the repository at this point in the history
* make activity changes textbox readonly

* Rework hiding search icon in readonly mode

* Restyle readonly vs editable state of form fields

---------

Co-authored-by: Tim Haasdyk <[email protected]>
  • Loading branch information
hahn-kev and myieye authored Jan 14, 2025
1 parent 20f623a commit 31cf726
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 22 deletions.
2 changes: 1 addition & 1 deletion frontend/viewer/src/ProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
{#if about}
<AboutDialog text={about} />
{/if}
{#if $features.feedback}
{#if $features.feedback && fwLiteConfig.feedbackUrl}
<Button
href={fwLiteConfig.feedbackUrl}
target="_blank"
Expand Down
7 changes: 7 additions & 0 deletions frontend/viewer/src/TestProjectView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
</script>
<ProjectView projectName={inMemoryLexboxApi.projectName} isConnected />
9 changes: 8 additions & 1 deletion frontend/viewer/src/WebComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import ProjectView from './ProjectView.svelte';
import { getSettings } from 'svelte-ux';
import css from './app.postcss?inline';
import {DotnetService} from '$lib/dotnet-types';
import {FwLitePlatform} from '$lib/dotnet-types/generated-types/FwLiteShared/FwLitePlatform';
let loading = true;
Expand Down Expand Up @@ -33,7 +35,12 @@
abortController.abort();
}
});
window.lexbox.ServiceProvider.setService(DotnetService.FwLiteConfig, {
appVersion: 'lexbox-viewer',
feedbackUrl: '',
os: FwLitePlatform.Web,
useDevAssets: true,//has no effect, but is required
});
const { currentTheme } = getSettings();
</script>

Expand Down
3 changes: 2 additions & 1 deletion frontend/viewer/src/lib/activity/ActivityView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@
{#if selectedRow}
<TextField label="Changes"
value={JSON.stringify(selectedRow.changes, null, 4)}
disabled
multiline
class="readonly"
class="readonly field"
classes={{input: 'h-80'}}/>
{/if}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,5 @@ export interface IMiniLcmJsInvokable
createExampleSentence(entryId: string, senseId: string, exampleSentence: IExampleSentence) : Promise<IExampleSentence>;
updateExampleSentence(entryId: string, senseId: string, before: IExampleSentence, after: IExampleSentence) : Promise<IExampleSentence>;
deleteExampleSentence(entryId: string, senseId: string, exampleSentenceId: string) : Promise<void>;
dispose() : Promise<void>;
}
/* eslint-enable */
38 changes: 24 additions & 14 deletions frontend/viewer/src/lib/entry-editor/field.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,33 @@
@apply col-span-2 pl-4;
}

.readonly {
&.TextField, .TextField {
opacity: 1;
&.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%);
}
}

[class~="border"] {
border: none;
}
&.readonly.TextField, .readonly.TextField, .readonly .TextField {
/* prevent other "disabled-state styles" from impacting readability */
opacity: 1;

input {
/* enable standard text selection */
pointer-events: auto;
cursor: text;
}
[class~="border"] {
border-color: hsl(var(--color-surface-content) / 20%);
background: transparent;
}

input {
/* enable standard text selection */
pointer-events: auto;
}

.append {
display: none;
}
.append, .prepend {
display: none;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions frontend/viewer/src/lib/history/HistoryView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
<div>
{#if record?.entity}
{#if record.entityName === 'Entry'}
<EntryEditor entry={record.entity} modalMode/>
<EntryEditor entry={record.entity} modalMode readonly/>
{:else if record.entityName === 'Sense'}
<div class="editor-grid">
<SenseEditor sense={record.entity}/>
<SenseEditor sense={record.entity} readonly/>
</div>
{:else if record.entityName === 'ExampleSentence'}
<div class="editor-grid">
<ExampleEditor example={record.entity} readonly={false}/>
<ExampleEditor example={record.entity} readonly/>
</div>
{/if}
{/if}
Expand Down

0 comments on commit 31cf726

Please sign in to comment.