From 13ceb54ac25b774e2b6f41b57939810d3b648282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20C=C3=B3rdova=20Nieto?= <43384963+Danble@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:51:51 -0600 Subject: [PATCH] Show history for dictionary and entry (initial step 1, not fully done) (#371) * create EntryHistory component and place it in EntryDisplay * create History Page * create all sortBy functionality * get content_updates data showing on history page and entry page --------- Co-authored-by: Jacob Bowdoin <7559478+jacob-8@users.noreply.github.com> Co-authored-by: jacob-8 --- .../lighthouse-comment-formatter.cjs | 2 +- eslint.config.js | 3 + .../lib/components/home/SelectedDict.svelte | 1 + .../components/home/SelectedDict.variants.ts | 40 ++++ .../lib/glosses/glossing-languages-list.json | 2 +- packages/site/src/lib/helpers/time.ts | 7 +- packages/site/src/lib/i18n/locales/am.json | 21 ++- packages/site/src/lib/i18n/locales/ar.json | 17 +- packages/site/src/lib/i18n/locales/as.json | 9 +- packages/site/src/lib/i18n/locales/bn.json | 19 +- packages/site/src/lib/i18n/locales/en.json | 11 +- packages/site/src/lib/i18n/locales/es.json | 11 +- packages/site/src/lib/i18n/locales/fr.json | 13 +- packages/site/src/lib/i18n/locales/ha.json | 25 +-- packages/site/src/lib/i18n/locales/he.json | 21 ++- packages/site/src/lib/i18n/locales/hi.json | 19 +- packages/site/src/lib/i18n/locales/id.json | 11 +- packages/site/src/lib/i18n/locales/ms.json | 15 +- packages/site/src/lib/i18n/locales/or.json | 15 +- packages/site/src/lib/i18n/locales/pt.json | 11 +- packages/site/src/lib/i18n/locales/ru.json | 13 +- packages/site/src/lib/i18n/locales/sw.json | 11 +- packages/site/src/lib/i18n/locales/vi.json | 11 +- packages/site/src/lib/i18n/locales/zh.json | 17 +- packages/site/src/lib/supabase/history.ts | 11 ++ .../src/routes/[dictionaryId]/SideMenu.svelte | 40 ++-- .../entry/[entryId]/EntryDisplay.svelte | 3 + .../entry/[entryId]/EntryDisplay.variants.ts | 6 + .../entry/[entryId]/EntryHistory.svelte | 25 +++ .../entry/[entryId]/EntryHistory.variants.ts | 72 ++++++++ .../[dictionaryId]/history/+page.svelte | 65 +++++++ .../routes/[dictionaryId]/history/+page.ts | 19 ++ .../[dictionaryId]/history/RecordRow.svelte | 24 +++ .../[dictionaryId]/history/_page.variants.ts | 174 ++++++++++++++++++ .../[dictionaryId]/history/historyFields.ts | 6 + .../[dictionaryId]/history/sortRecords.svelte | 82 +++++++++ .../history/sortedColumnStore.ts | 3 + .../20250116172250_read-content-updates.sql | 4 + 38 files changed, 713 insertions(+), 146 deletions(-) create mode 100644 packages/site/src/lib/components/home/SelectedDict.variants.ts create mode 100644 packages/site/src/lib/supabase/history.ts create mode 100644 packages/site/src/routes/[dictionaryId]/entry/[entryId]/EntryHistory.svelte create mode 100644 packages/site/src/routes/[dictionaryId]/entry/[entryId]/EntryHistory.variants.ts create mode 100644 packages/site/src/routes/[dictionaryId]/history/+page.svelte create mode 100644 packages/site/src/routes/[dictionaryId]/history/+page.ts create mode 100644 packages/site/src/routes/[dictionaryId]/history/RecordRow.svelte create mode 100644 packages/site/src/routes/[dictionaryId]/history/_page.variants.ts create mode 100644 packages/site/src/routes/[dictionaryId]/history/historyFields.ts create mode 100644 packages/site/src/routes/[dictionaryId]/history/sortRecords.svelte create mode 100644 packages/site/src/routes/[dictionaryId]/history/sortedColumnStore.ts create mode 100644 supabase/migrations/20250116172250_read-content-updates.sql diff --git a/.github/workflows/lighthouse-comment-formatter.cjs b/.github/workflows/lighthouse-comment-formatter.cjs index de1a7eaaa..8bc310738 100644 --- a/.github/workflows/lighthouse-comment-formatter.cjs +++ b/.github/workflows/lighthouse-comment-formatter.cjs @@ -76,4 +76,4 @@ module.exports = ({ lighthouseOutputs, targetPlatform }) => { return makeComment(lighthouseOutputs, targetPlatform); }; -// from https://blog.logrocket.com/lighthouse-meets-github-actions-use-lighthouse-ci/ \ No newline at end of file +// from https://blog.logrocket.com/lighthouse-meets-github-actions-use-lighthouse-ci/ diff --git a/eslint.config.js b/eslint.config.js index fb497b5ec..b49378c2a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -158,6 +158,8 @@ export default antfu( 'svelte/mustache-spacing': 'error', 'svelte/html-closing-bracket-spacing': 'error', 'svelte/no-reactive-reassign': ['warn', { props: false }], + 'no-unused-vars': 'warn', + 'unused-imports/no-unused-vars': 'warn', 'svelte/html-quotes': 'off', // should it enforce double quotes? 'svelte/no-at-html-tags': 'off', @@ -166,6 +168,7 @@ export default antfu( 'style/space-infix-ops': 'off', 'no-undef-init': 'off', 'no-self-assign': 'off', + 'import/no-self-import': 'off', }, }, }) diff --git a/packages/site/src/lib/components/home/SelectedDict.svelte b/packages/site/src/lib/components/home/SelectedDict.svelte index 1f7e33d51..ea1beabe8 100644 --- a/packages/site/src/lib/components/home/SelectedDict.svelte +++ b/packages/site/src/lib/components/home/SelectedDict.svelte @@ -89,6 +89,7 @@ {/if} + diff --git a/packages/site/src/routes/[dictionaryId]/history/sortedColumnStore.ts b/packages/site/src/routes/[dictionaryId]/history/sortedColumnStore.ts new file mode 100644 index 000000000..7351cfb96 --- /dev/null +++ b/packages/site/src/routes/[dictionaryId]/history/sortedColumnStore.ts @@ -0,0 +1,3 @@ +import { writable } from 'svelte/store' + +export const sortedColumn = writable('') diff --git a/supabase/migrations/20250116172250_read-content-updates.sql b/supabase/migrations/20250116172250_read-content-updates.sql new file mode 100644 index 000000000..d88c9a3bd --- /dev/null +++ b/supabase/migrations/20250116172250_read-content-updates.sql @@ -0,0 +1,4 @@ +CREATE POLICY "Can view content updates" + ON content_updates + FOR SELECT + USING (TRUE); \ No newline at end of file