refactor: drop lang="ts" from script elements

I noticed that tooling isn't capable of handling it.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
André Jaenisch 2024-03-15 10:49:30 +01:00
parent e00e274873
commit edfbcce5a2
No known key found for this signature in database
GPG key ID: 5A668E771F1ED854
11 changed files with 78 additions and 42 deletions

View file

@ -11,18 +11,18 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { Avatar } from '@skeletonlabs/skeleton';
/**
* URL to Avatar image.
*/
export let avatar: string | undefined = '';
export let avatar = '';
/**
* Name to derive initials from if no avatar is given.
*/
export let displayName: string | undefined = '';
export let displayName = '';
</script>
<Avatar src={avatar} alt={displayName} width="w-32" rounded="rounded-full" initials={displayName} />

View file

@ -11,7 +11,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { _ } from 'svelte-i18n';
</script>

View file

@ -11,16 +11,19 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
/**
* Formatted datetime according to the locale.
*/
export let created_at_formatted: string | null = '';
<script>
/**
* Date object for created time.
* @type {Date | null}
*/
export let created_at: Date | null = null;
export let created_at = null;
/**
* Locale to format the datetime according to.
*/
export let locale = 'en';
$: created_at_formatted = new Intl.DateTimeFormat(locale).format(created_at);
</script>
{#if created_at && created_at_formatted}

View file

@ -11,23 +11,31 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { _ } from 'svelte-i18n';
/**
* Under which name shall the person be known?
*/
export let displayName: string = '';
export let displayName = '';
/**
* Translation keys.
*/
export let i18n = {
heading: ''
};
/**
* How to correctly address this person.
*/
export let pronoun: string = '';
export let pronoun = '';
</script>
<h1 class="h1 font-semibold text-4xl leading-tight">
<!-- FIXME: Include placeholder in i18n -->
<span class="sr-only">{$_('page.profile.heading')}</span>
<span class="sr-only">{$_(i18n.heading)}</span>
{displayName}
</h1>
{#if pronoun}
<p class="leading-normal my-1">({pronoun})</p>
{/if}

View file

@ -11,25 +11,44 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { _ } from 'svelte-i18n';
/**
* PageData provided by SvelteKit.
*/
export let data: unknown = {
export let data = {
servers: {}
};
/**
* Form handling by SvelteKit
*/
export let form: unknown = null;
export let form = null;
/**
* Translation keys to enable reuse
*/
export let i18n: null;
export let i18n = {
fields: {
account: {
label: ''
},
passphrase: {
label: '',
placeholder: ''
},
server: {
label: ''
}
},
reset: '',
submit: '',
validation: {
incorrect: '',
missing: ''
}
};
/**
* Allow for linking stories in Storybook.

View file

@ -11,13 +11,13 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import ImportProjectTemplate from '../templates/ImportProject.svelte';
/**
* Data populated by SvelteKit
*/
export let data: unknown = null;
export let data = null;
</script>
<ImportProjectTemplate {data} />

View file

@ -11,20 +11,20 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import LoginTemplate from '../templates/Login.svelte';
/**
* PageData provided by SvelteKit.
*/
export let data: unknown = {
export let data = {
servers: {}
};
/**
* Form handling by SvelteKit
*/
export let form: unknown = null;
export let form = null;
</script>
<LoginTemplate {data} {form} />

View file

@ -11,13 +11,13 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import ProfileTemplate from '../templates/Profile.svelte';
/**
* Data populated by SvelteKit
*/
export let data: unknown = null;
export let data = null;
</script>
<ProfileTemplate {data} />

View file

@ -11,14 +11,14 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { AlertFill16, Info16, Repo24, Upload16 } from 'svelte-octicons';
import { _ } from 'svelte-i18n';
/**
* Required context for populating the template.
*/
export const data: unknown = null;
export const data = null;
</script>
<section class="w-full">

View file

@ -11,7 +11,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { _ } from 'svelte-i18n';
import LoginForm from '../organisms/LoginForm.svelte';
@ -19,14 +19,14 @@ You should have received a copy of the GNU Affero General Public License along w
/**
* PageData provided by SvelteKit.
*/
export let data: unknown = {
export let data = {
servers: {}
};
/**
* Form handling by SvelteKit
*/
export let form: unknown = {
export let form = {
servers: {}
};

View file

@ -11,7 +11,7 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<script lang="ts">
<script>
import { _, date } from 'svelte-i18n';
import { NorthStar24, Star16 } from 'svelte-octicons';
@ -20,12 +20,21 @@ 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';
import type { ProfileData } from './Profile.d.ts';
/**
* Required context for populating the template.
*/
export let data: ProfileData = null;
export let data = {
locale: '',
user: {
avatar: '',
created_at: null,
created_with: '',
display_name: '',
instance: '',
pronoun: '',
username: ''
}
};
/**
* Allow for linking stories in Storybook.
@ -41,10 +50,7 @@ You should have received a copy of the GNU Affero General Public License along w
<!-- Board -->
<div class="flex flex-1 flex-col ps-8">
<div class="self-end">
<Created
created_at={data.user.created_at}
created_at_formatted={data.user.created_at_formatted}
/>
<Created created_at={data.user.created_at} locale={data.locale} />
<BlockOrReport />
</div>
<!-- Top Row -->
@ -52,7 +58,7 @@ You should have received a copy of the GNU Affero General Public License along w
<!-- Board -->
<div class="flex flex-col flex-1 gap-2">
<div class="flex items-end">
<DisplayName displayName={data.user.display_name} pronoun={data.user.pronoun} />
<DisplayName displayName={data.user.display_name} {i18n} pronoun={data.user.pronoun} />
</div>
<span class="leading-tight">
{data.user.username}@{data.user.instance}