Skip to content

Commit 7c7cb50

Browse files
hahn-kevmyieye
andauthored
ShadCN UI main (#1589)
* wire up project picker * show the current project as selected in the dropdown * Playwright screenshots for fw lite ui (#1590) * setup screenshot testing using playwright * ensure UI is consistent for tests by removing date from dev version and by not changing the sync icon --------- Co-authored-by: Tim Haasdyk <[email protected]> * change index.html in viewer so when you open it you're taken to /testing/project-view * Migrate dialogs to shadcn (#1612) * use shadCn dialog for NewEntryDialog * Refactor DeleteDialog to use the ShadCN dialog * use ShadCN dialog in ActivityView.svelte and HistoryView.svelte * convert About and Troubleshooting Dialog to use shadCN --------- Co-authored-by: Tim Haasdyk <[email protected]> * Use runes for project services (#1593) * change writing system service to use runes and the new project context. * use project context for history service * fix proxy issues due to some rune and resource stuff * setup parts of speech service * migrate complex form types to use runes * run CI on PRs for shadcn main * fix up viewer to work with new project context * fix up viewer-specific lint errors by using project context for tests * Refactor editor classes to editor components (#1619) * Refactor editor classes to editor components * Extract editor sandbox into own component * Fix invalid binding * Introduce editor root and name editor container --------- Co-authored-by: Kevin Hahn <[email protected]> * Migrate entry select dialog (#1620) * use a boundry on failing areas in the sandbox. Tweak index.html to only send to testing when the path is empty * convert EntryOrSensePicker.svelte to svelte 5 and ShadCN * use a ring to indicate selection of entry rows * move new entry dialog and delete dialog to use a new dialog service based on project context * migrate save handler * pull Add entry button out of sidebar and create SidebarPrimaryAction.svelte which will place a button in the sidebar with context of the current view. * Fix stacking dialogs * Fix selecting newly created entry --------- Co-authored-by: Tim Haasdyk <[email protected]> * Shadcn Single-select (#1623) * Fix sandbox * Make Editor.Field.Body only 1 column by default * Add note to sandbox editor * Remove min-height from multi-select on desktop * Add single-select component to sandbox editor * Remove badge from empty single-select * Incorporate PR feedback * Make rich-text-editor support readonly mode (#1624) * Make rich-text-editor support readonly mode * add a checkbox to toggle readonly mode on sandbox. Wrap the rich editor with label in a div otherwise the cursor is incorrect when hovering over the editor. --------- Co-authored-by: Kevin Hahn <[email protected]> * Ensure user can tab to readonly rich-text just like other inputs (#1638) * Fix entry view and filter outline overflow (#1639) * Fix entry-view scroll-area overflowing parent * Prevent new-entry-button from being covered up by sidebar menu items * Fix filter-field outline overflowing and tweak padding/margins * Make refresh button more distinct and animation less jittery * Use icon button size for entry-view icon buttons * Add gap between entry-view icon buttons * WS single and multi inputs (#1637) * Add radio button comment for our future selves * Add multi-ws-input and simple inputs to sandbox editor * Fix up readonly field-editor props * Put value preview beside sandbox editor * hook up delete buttons in new project view (#1635) * add new EntryDeletedEvent and notify on delete from sync or the notify wrapper * introduce a project event bus use the bus for entry deleted events * document how to use shadcn * add a right click menu to the entries list to enable deleting entries * add open in new to entry menu * use entry menu for entry list context menu closes #1640 --------- Co-authored-by: Tim Haasdyk <[email protected]> * display a dictionary preview on the entry list (#1641) * display a dictionary preview on the entry list * make sense numbers links in dictionary preview * show dictionary preview in the entry view * allow making the preview sticky --------- Co-authored-by: Tim Haasdyk <[email protected]> * update bits ui to fix issue on popup close * Tweak muted backgrounds (#1647) * 1636 editor layout (#1654) * Introduce EntryEditorPrimitive * Rename SenseEditor to SenseEditorPrimitive. That's what it is. * Rename ExampleEditor to ExampleEditorPrimitive * Replace grid-layer class with EditorSubGrid component * Add onchange events to fields * Truncate selects to first 100 filtered items with hint at end of truncated list * Introduce view-text helper/type for lite vs classic texts * Add readonly dev toggle. * Wrap editor in Editor.Root * Migrate sense fields to shadcn * Migrate entry fields to shadcn * Migrate example sentence fields to shadcn * Some clean up * Extend pickViewText api and translate editor headers * Silence warnings by binding entry objects * Fix field borders peeking around side of sticky header at some zoom-levels. * Fix matching projects (#1653) * Fix can't open fwdata projects if crdt project with same code exists * Reuse Lexbox project name for fwdata projects * Fix crdt copy not shown in project-picker if fwdata copy exists. And sort. * Fix crdt and fwdata copies always highlighted together on hover * Fix current fwdata project not highlighted in project-picker if crdt copy also exists * Fix both crdt and fwdata copies of current project highlighted in project-picker * Fix: project code not shown on synced server projects * Migrate components, complex forms and sense and example sentence actions (#1655) * Make icon and icon buttons support baseline alignment * Migrate component and complex-forms to shadcn/Svelte 5 * Prevent focus rings from being clipped and tweak preview position on mobile * Migrate rest of editor to Svelte 5 and shadcn * Remove reorderer-swapper and use svelte-context in reorderr hierarchy * Make new sense FAB look like new entry FAB * Rehide reorderer if only 1 item * Move pickIcon into the only component that now uses it * write a sandbox test for the reorderer * translate delete prompt text * Use getters instead of $state so root-props react to updates. * Use simple $derived.by instead of watch --------- Co-authored-by: Kevin Hahn <[email protected]> * Url state tracking (ShadCN) (#1662) * create QueryParamState to enable reactive url params * fix bug in EntryOrSenseItemList.svelte to remove a trailing `}` from the query parameter * make the browse view `selectedEntryId` reactive based on query params * make dialogs reactive to url and the back button * use router for handling browse and tasks views * add a fallback default route in the project view --------- Co-authored-by: Tim Haasdyk <[email protected]> * hide audio writing systems since we don't support them * fix linting * remove svelte ux from tailwind (#1664) * add a border to an empty server list * migrate LocalizationPicker.svelte to use Shad CN and not the Svelte UX menu * slide icons and loading indicator on change * remove svelte-ux on sandbox page --------- Co-authored-by: Tim Haasdyk <[email protected]> * fix icon button styles, add a sandbox which shows button configurations * Don't run install 3 times (#1669) * cleanup lint errors * fix DictionaryEntry.svelte links * show history when clicking the history button on an entry * Finalize shadcn buttons (#1670) * Fix delete dialog close detection * Wire up sidebar and hide unimplemented content * Migrate home-page app-bar buttons to shadcn * Use function instead of prop to open troubleshooting dialog * Fix broken enter animation due to troubleshooting dialog resize after open. * Introduce responsive-menu for entry-menu * Add Open in FieldWorks button * Fix logo doesn't respond to dark-mode * Condense home-view app-bar * Make radio buttons bigger on mobile * only show Open In Flex button when supported --------- Co-authored-by: Kevin Hahn <[email protected]> * fix lint error * fix more lint errors * Persist changes in EntryView.svelte (#1671) * notify entry changes when sense or example are deleted * make entry persistence service to attach to entry editor * Use project-code for detecting project events * Fix entry ID mismatch after changing entries --------- Co-authored-by: Tim Haasdyk <[email protected]> * Setup back handler (#1673) * add QueryParamState option for using replace when a default value is set * replace dialogs using QueryParamState with `useBackHandler` * use back handler in drawer on mobile. Cleanup back handler when it's component is destroyed * handle case where we navigate from an open dialog and warn that history was not cleaned up * Make svelte-check and lint happy --------- Co-authored-by: Tim Haasdyk <[email protected]>
1 parent c5503ef commit 7c7cb50

File tree

198 files changed

+7944
-3710
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+7944
-3710
lines changed

.github/workflows/fw-lite.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
branches:
2222
- develop
2323
- main
24+
- shadcn-ui-main #just for now ensure PRs to this branch have checks run
2425
env:
2526
VIEWER_BUILD_OUTPUT_DIR: backend/FwLite/FwLiteShared/wwwroot/viewer
2627
jobs:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace FwLiteShared.Events;
2+
3+
public class EntryDeletedEvent(Guid entryId) : IFwEvent
4+
{
5+
public FwEventType Type => FwEventType.EntryDeleted;
6+
public bool IsGlobal => false;
7+
public Guid EntryId { get; init; } = entryId;
8+
}

backend/FwLite/FwLiteShared/Events/IFwEvent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace FwLiteShared.Events;
44

55
[JsonPolymorphic]
66
[JsonDerivedType(typeof(EntryChangedEvent), nameof(EntryChangedEvent))]
7+
[JsonDerivedType(typeof(EntryDeletedEvent), nameof(EntryDeletedEvent))]
78
[JsonDerivedType(typeof(ProjectEvent), nameof(ProjectEvent))]
89
[JsonDerivedType(typeof(AuthenticationChangedEvent), nameof(AuthenticationChangedEvent))]
910
public interface IFwEvent
@@ -19,4 +20,5 @@ public enum FwEventType
1920
EntryChanged,
2021
AuthenticationChanged,
2122
ProjectEvent,
23+
EntryDeleted
2224
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
@page "/project/{projectName}"
1+
@page "/project/{projectName}/{*path}"
22
@using FwLiteShared.Layout
33
@layout SvelteLayout;
44

55
@code {
66
[Parameter]
77
public required string ProjectName { get; set; }
8+
[Parameter]
9+
public required string Path { get; set; }
810
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
@page "/fwdata/{projectName}"
1+
@page "/fwdata/{projectName}/{*path}"
22
@using FwLiteShared.Layout
33
@layout SvelteLayout;
44

55
@code {
66

77
[Parameter]
88
public required string ProjectName { get; set; }
9+
[Parameter]
10+
public required string Path { get; set; }
911

1012
}
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
@page "/sandbox"
1+
@page "/sandbox/{*path}"
22
@using FwLiteShared.Layout
33
@using FwLiteShared.Services
44
@layout SvelteLayout;
55

6-
@*this looks empty because it is, but it's required to declare the route which is then used by the svelte router*@
6+
@code {
7+
8+
[Parameter]
9+
public required string Path { get; set; }
10+
11+
}
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
@page "/testing/project-view"
1+
@page "/testing/project-view/{*path}"
22
@using FwLiteShared.Layout
33
@layout SvelteLayout;
4+
5+
@code {
6+
7+
[Parameter]
8+
public required string Path { get; set; }
9+
10+
}

backend/FwLite/FwLiteShared/Services/MiniLcmApiNotifyWrapper.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ public async Task NotifyEntryChangedAsync(Guid entryId)
7272
bus.PublishEntryChangedEvent(project, entry);
7373
}
7474

75+
public void NotifyEntryDeleted(Guid entryId)
76+
{
77+
bus.PublishEvent(project, new EntryDeletedEvent(entryId));
78+
}
79+
7580
// ********** Overrides go here **********
7681

7782
async Task<Entry> IMiniLcmWriteApi.CreateEntry(Entry entry)
@@ -105,6 +110,24 @@ async Task IMiniLcmWriteApi.DeleteComplexFormComponent(ComplexFormComponent comp
105110
await NotifyEntryChangedAsync(complexFormComponent.ComponentEntryId);
106111
}
107112

113+
async Task IMiniLcmWriteApi.DeleteEntry(Guid id)
114+
{
115+
await _api.DeleteEntry(id);
116+
NotifyEntryDeleted(id);
117+
}
118+
119+
async Task IMiniLcmWriteApi.DeleteSense(Guid entryId, Guid senseId)
120+
{
121+
await _api.DeleteSense(entryId, senseId);
122+
await NotifyEntryChangedAsync(entryId);
123+
}
124+
125+
async Task IMiniLcmWriteApi.DeleteExampleSentence(Guid entryId, Guid senseId, Guid exampleSentenceId)
126+
{
127+
await _api.DeleteExampleSentence(entryId, senseId, exampleSentenceId);
128+
await NotifyEntryChangedAsync(entryId);
129+
}
130+
108131
void IDisposable.Dispose()
109132
{
110133
}

backend/FwLite/FwLiteShared/Sync/SyncService.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using MiniLcm;
1111
using MiniLcm.Models;
1212
using SIL.Harmony;
13+
using SIL.Harmony.Changes;
1314

1415
namespace FwLiteShared.Sync;
1516

@@ -95,6 +96,13 @@ private async Task SendNotifications(SyncResults syncResults)
9596
logger.LogError("Failed to get entry {EntryId}, was not found", entryId);
9697
}
9798
}
99+
100+
foreach (var deleteChange in syncResults.MissingFromLocal
101+
.SelectMany(c => c.ChangeEntities, (_, change) => change.Change)
102+
.OfType<DeleteChange<Entry>>())
103+
{
104+
changeEventBus.PublishEvent(currentProjectService.Project, new EntryDeletedEvent(deleteChange.EntityId));
105+
}
98106
}
99107
catch (Exception e)
100108
{

backend/FwLite/FwLiteWeb/Routes/FwIntegrationRoutes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static IEndpointConventionBuilder MapFwIntegrationRoutes(this WebApplicat
2020
});
2121
return operation;
2222
});
23-
group.MapGet("/open/entry/{id}",
23+
group.MapGet("/link/entry/{id}",
2424
async ([FromServices] FwDataProjectContext context,
2525
[FromServices] IHubContext<FwDataMiniLcmHub, ILexboxHubClient> hubContext,
2626
[FromServices] FwDataFactory factory,
@@ -29,8 +29,8 @@ public static IEndpointConventionBuilder MapFwIntegrationRoutes(this WebApplicat
2929
if (context.Project is null) return Results.BadRequest("No project is set in the context");
3030
await hubContext.Clients.Group(context.Project.Name).OnProjectClosed(CloseReason.Locked);
3131
factory.CloseProject(context.Project);
32-
//need to use redirect as a way to not trigger flex until after we have closed the project
33-
return Results.Redirect(FwLink.ToEntry(id, context.Project.Name));
32+
var link = FwLink.ToEntry(id, context.Project.Name);
33+
return Results.Text(link, "text/plain");
3434
});
3535
return group;
3636
}

0 commit comments

Comments
 (0)