From 08e739440eb2f6141cd85ad6079dc191fae94fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Wed, 13 Mar 2024 14:31:33 +0100 Subject: [PATCH] feat: new projects page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the page that will be reached after a new project was added or imported unless there have been projects before already. Signed-off-by: André Jaenisch --- .../components/molecules/MoreFilters.svelte | 31 +++++ .../components/molecules/Pagination.svelte | 50 ++++++++ src/lib/components/molecules/Projects.svelte | 31 +++++ src/lib/components/molecules/Search.svelte | 41 +++++++ src/lib/components/molecules/Starred.svelte | 31 +++++ src/lib/components/organisms/FileTable.svelte | 108 ++++++++++++++++++ src/lib/components/pages/Projects.svelte | 25 ++++ src/lib/components/templates/Profile.svelte | 7 ++ src/lib/components/templates/Projects.svelte | 76 ++++++++++++ src/lib/i18n/locales/de.json | 32 ++++++ src/lib/i18n/locales/en.json | 32 ++++++ src/lib/i18n/locales/he.json | 32 ++++++ src/routes/projects/+page.server.js | 92 +++++++++++++++ src/routes/projects/+page.svelte | 14 +++ 14 files changed, 602 insertions(+) create mode 100644 src/lib/components/molecules/MoreFilters.svelte create mode 100644 src/lib/components/molecules/Pagination.svelte create mode 100644 src/lib/components/molecules/Projects.svelte create mode 100644 src/lib/components/molecules/Search.svelte create mode 100644 src/lib/components/molecules/Starred.svelte create mode 100644 src/lib/components/organisms/FileTable.svelte create mode 100644 src/lib/components/pages/Projects.svelte create mode 100644 src/lib/components/templates/Projects.svelte create mode 100644 src/routes/projects/+page.server.js create mode 100644 src/routes/projects/+page.svelte diff --git a/src/lib/components/molecules/MoreFilters.svelte b/src/lib/components/molecules/MoreFilters.svelte new file mode 100644 index 0000000..1251c4b --- /dev/null +++ b/src/lib/components/molecules/MoreFilters.svelte @@ -0,0 +1,31 @@ + + + + +
+ +
diff --git a/src/lib/components/molecules/Pagination.svelte b/src/lib/components/molecules/Pagination.svelte new file mode 100644 index 0000000..d3a2bff --- /dev/null +++ b/src/lib/components/molecules/Pagination.svelte @@ -0,0 +1,50 @@ + + + + + diff --git a/src/lib/components/molecules/Projects.svelte b/src/lib/components/molecules/Projects.svelte new file mode 100644 index 0000000..a13f1ad --- /dev/null +++ b/src/lib/components/molecules/Projects.svelte @@ -0,0 +1,31 @@ + + + + +
+ +
diff --git a/src/lib/components/molecules/Search.svelte b/src/lib/components/molecules/Search.svelte new file mode 100644 index 0000000..158e357 --- /dev/null +++ b/src/lib/components/molecules/Search.svelte @@ -0,0 +1,41 @@ + + + + +
+
+ + + +
+
diff --git a/src/lib/components/molecules/Starred.svelte b/src/lib/components/molecules/Starred.svelte new file mode 100644 index 0000000..cd66666 --- /dev/null +++ b/src/lib/components/molecules/Starred.svelte @@ -0,0 +1,31 @@ + + + + +
+ +
diff --git a/src/lib/components/organisms/FileTable.svelte b/src/lib/components/organisms/FileTable.svelte new file mode 100644 index 0000000..b625919 --- /dev/null +++ b/src/lib/components/organisms/FileTable.svelte @@ -0,0 +1,108 @@ + + + + + + + + + + + + + {#each projects as project} + + + + + {/each} + +
+ {$_(i18n.heading.name)} + + + {$_(i18n.heading.lastUpdated)} +
+ +
+
+ {project.name} + {#each project.members as member} + + {member.name} + + {/each} +
+
+ {project.description} +
+
+ {#each project.tags as tag} + + {tag.name} + + {/each} +
+
+
+
+
+ + + +
+
+ {$_(i18n.table.updated, { + values: { + relativeTime: project.lastUpdated.toISOString() + } + })} +
+
+
diff --git a/src/lib/components/pages/Projects.svelte b/src/lib/components/pages/Projects.svelte new file mode 100644 index 0000000..6fa6de7 --- /dev/null +++ b/src/lib/components/pages/Projects.svelte @@ -0,0 +1,25 @@ + + + + + diff --git a/src/lib/components/templates/Profile.svelte b/src/lib/components/templates/Profile.svelte index dfcfa48..5657f09 100644 --- a/src/lib/components/templates/Profile.svelte +++ b/src/lib/components/templates/Profile.svelte @@ -20,6 +20,13 @@ You should have received a copy of the GNU Affero General Public License along w import Created from '../atoms/Created.svelte'; import DisplayName from '../atoms/DisplayName.svelte'; + /** + * Translation keys. + */ + const i18n = { + heading: 'page.profile.heading' + }; + /** * Required context for populating the template. */ diff --git a/src/lib/components/templates/Projects.svelte b/src/lib/components/templates/Projects.svelte new file mode 100644 index 0000000..1358f29 --- /dev/null +++ b/src/lib/components/templates/Projects.svelte @@ -0,0 +1,76 @@ + + + + +
+
+ + + + +
+ + + + +
diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 417e113..ac729e1 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -79,6 +79,38 @@ "heading": "Projekte" } }, + "projects": { + "file_table": { + "updated": "" + }, + "form": { + "fields": { + "more_filters": { + "submit": "" + }, + "projects": { + "submit": "" + }, + "search": { + "placeholder": "", + "submit": "" + }, + "starred": { + "submit": "" + } + } + }, + "nav": { + "next": "", + "previous": "" + }, + "table": { + "heading": { + "last_updated": "", + "name": "" + } + } + }, "welcome": "Willkommen bei Anvil!" } } diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index 2ae8919..a4c0bf3 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -79,6 +79,38 @@ "heading": "Projects" } }, + "projects": { + "file_table": { + "updated": "Updated {relativeTime}" + }, + "form": { + "fields": { + "more_filters": { + "submit": "More Filters" + }, + "projects": { + "submit": "My projects" + }, + "search": { + "placeholder": "Search or filter", + "submit": "Submit" + }, + "starred": { + "submit": "Starred" + } + } + }, + "nav": { + "next": "Next", + "previous": "Previous" + }, + "table": { + "heading": { + "last_updated": "Last updated", + "name": "Name" + } + } + }, "welcome": "Welcome to Anvil!" } } diff --git a/src/lib/i18n/locales/he.json b/src/lib/i18n/locales/he.json index 4463811..36013e5 100644 --- a/src/lib/i18n/locales/he.json +++ b/src/lib/i18n/locales/he.json @@ -79,6 +79,38 @@ "heading": "פרויקטים" } }, + "projects": { + "file_table": { + "updated": "" + }, + "form": { + "fields": { + "more_filters": { + "submit": "" + }, + "projects": { + "submit": "" + }, + "search": { + "placeholder": "", + "submit": "" + }, + "starred": { + "submit": "" + } + } + }, + "nav": { + "next": "", + "previous": "" + }, + "table": { + "heading": { + "last_updated": "", + "name": "" + } + } + }, "welcome": "" } } diff --git a/src/routes/projects/+page.server.js b/src/routes/projects/+page.server.js new file mode 100644 index 0000000..13ff6ea --- /dev/null +++ b/src/routes/projects/+page.server.js @@ -0,0 +1,92 @@ +/* Providing context for ImportProject page. + * Copyright (C) 2024 André Jaenisch + * SPDX-FileCopyrightText: 2024 André Jaenisch + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + */ + +/** @type {import('./$types').PageServerLoad} */ +export async function load({ params }) { + return { + projects: [ + { + name: 'Project A', + description: + 'This software project is a web-based application that will allow users to book appointments online.', + avatar: 'https://example.com', + // Date back three months + lastUpdated: new Date(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000), + members: [ + { + name: 'Person A', + avatar: 'https://example.com', + slug: 'a' + }, + { + name: 'Person B', + avatar: 'https://example.com', + slug: 'b' + }, + { + name: 'Person C', + avatar: 'https://example.com', + slug: 'c' + } + ], + tags: [ + { + name: 'ActivityPub', + link: '/tag/ActivityPub' + }, + { + name: 'css', + link: '/tag/css' + }, + { + name: 'guile', + link: '/tag/guile' + } + ] + }, + { + name: 'Project B', + description: + 'This software project is a web-based application that will allow users to book appointments online.', + avatar: 'https://example.com', + // Date back three months + lastUpdated: new Date(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000), + members: [ + { + name: 'Person A', + avatar: 'https://example.com', + slug: 'a' + }, + { + name: 'Person B', + avatar: 'https://example.com', + slug: 'b' + } + ], + tags: [ + { + name: 'ActivityPub', + link: '/tag/ActivityPub' + }, + { + name: 'css', + link: '/tag/css' + }, + { + name: 'guile', + link: '/tag/guile' + } + ] + } + ] + }; +} diff --git a/src/routes/projects/+page.svelte b/src/routes/projects/+page.svelte new file mode 100644 index 0000000..eaa2a98 --- /dev/null +++ b/src/routes/projects/+page.svelte @@ -0,0 +1,14 @@ + + + + +