From 8e92e49e192f508527a6239dc1579d10f00fc7f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Jaenisch?= Date: Sun, 23 Jun 2024 14:53:46 +0200 Subject: [PATCH] refactor: use objects for properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I was reading warnings during the execution of tests and fixed them for ImportProject templates and pages. Signed-off-by: André Jaenisch --- src/lib/components/pages/ImportProject.svelte | 2 +- .../components/templates/ImportProject.svelte | 72 ++++++++++++++----- 2 files changed, 56 insertions(+), 18 deletions(-) diff --git a/src/lib/components/pages/ImportProject.svelte b/src/lib/components/pages/ImportProject.svelte index e29ebc7..d5016b8 100644 --- a/src/lib/components/pages/ImportProject.svelte +++ b/src/lib/components/pages/ImportProject.svelte @@ -17,7 +17,7 @@ You should have received a copy of the GNU Affero General Public License along w /** * Data populated by SvelteKit */ - export let data = null; + export let data = {}; diff --git a/src/lib/components/templates/ImportProject.svelte b/src/lib/components/templates/ImportProject.svelte index f86db68..f6c1dbe 100644 --- a/src/lib/components/templates/ImportProject.svelte +++ b/src/lib/components/templates/ImportProject.svelte @@ -18,7 +18,45 @@ You should have received a copy of the GNU Affero General Public License along w /** * Required context for populating the template. */ - export const data = null; + export let data = {}; + + /** + * Translation keys. + */ + const i18n = { + form: { + avatar: 'page.import_project.form.avatar', + components: 'page.import_project.form.components', + fields: { + avatar: { + label: 'page.import_project.form.fields.avatar.label' + }, + description: { + label: 'page.import_project.form.fields.description.label', + placeholder: 'page.import_project.form.fields.description.placeholder' + }, + issues: { + label: 'page.import_project.form.fields.issues.label' + }, + name: { + error: 'page.import_project.form.fields.name.error', + label: 'page.import_project.form.fields.name.label', + placeholder: 'page.import_project.form.fields.name.placeholder' + }, + pr: { + label: 'page.import_project.form.fields.pr.label' + }, + repository: { + hint: 'page.import_project.form.fields.repository.hint', + label: 'page.import_project.form.fields.repository.label', + placeholder: 'page.import_project.form.fields.repository.placeholder' + } + }, + submit: 'page.import_project.form.submit' + }, + heading: 'page.import_project.heading', + intro: 'page.import_project.intro' + };
@@ -26,12 +64,12 @@ You should have received a copy of the GNU Affero General Public License along w class="w-96 flex flex-col gap-6 mx-auto px-8 py-8 bg-surface-100 border border-surface-300" name="import-project" > -

{$_('page.import_project.heading')}

-

{$_('page.import_project.intro')}

+

{$_(i18n.heading)}

+

{$_(i18n.intro)}

@@ -40,11 +78,11 @@ You should have received a copy of the GNU Affero General Public License along w name="project-name" class="input input-error" type="text" - placeholder={$_('page.import_project.form.fields.name.placeholder')} + placeholder={$_(i18n.form.fields.name.placeholder)} />
- {$_('page.import_project.form.fields.name.error')} + {$_(i18n.form.fields.name.error)}
domain.example/projects/NameUpdateRealtime @@ -54,19 +92,19 @@ You should have received a copy of the GNU Affero General Public License along w