migrate: fix some pages
This commit is contained in:
1 parent
10ef4123da
commit
ffcd9faa96
4 files changed
+54
-43
No files matched your search
@@ -1,15 +1,26 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { preventDefault } from 'svelte/legacy';
|
||||||
|
|
||||||
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
import { DocumentPlus, Icon } from 'svelte-hero-icons'
|
||||||
import { Label, TextInput } from 'mono-svelte'
|
import { Label, TextInput } from 'mono-svelte'
|
||||||
|
|
||||||
export let accept = 'image/*'
|
interface Props {
|
||||||
export let files: FileList | undefined | null = null
|
accept?: string;
|
||||||
export let label: string | undefined = undefined
|
files?: FileList | undefined | null;
|
||||||
export let url: string | undefined = undefined
|
label?: string | undefined;
|
||||||
|
url?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
let dragover = false
|
let {
|
||||||
|
accept = 'image/*',
|
||||||
|
files = $bindable(null),
|
||||||
|
label = undefined,
|
||||||
|
url = undefined
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
$: previewURL = files ? URL.createObjectURL(files[0]) : undefined
|
let dragover = $state(false)
|
||||||
|
|
||||||
|
let previewURL = $derived(files ? URL.createObjectURL(files[0]) : undefined)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
@@ -22,20 +33,20 @@
|
|||||||
: ''}
|
: ''}
|
||||||
{url != undefined ? 'rounded-b-none' : ''}
|
{url != undefined ? 'rounded-b-none' : ''}
|
||||||
"
|
"
|
||||||
on:drop|preventDefault={(event) => (files = event.dataTransfer?.files)}
|
ondrop={preventDefault((event) => (files = event.dataTransfer?.files))}
|
||||||
on:dragover|preventDefault={(event) => {
|
ondragover={preventDefault((event) => {
|
||||||
if (event.dataTransfer) {
|
if (event.dataTransfer) {
|
||||||
event.dataTransfer.dropEffect = 'copy'
|
event.dataTransfer.dropEffect = 'copy'
|
||||||
dragover = true
|
dragover = true
|
||||||
}
|
}
|
||||||
}}
|
})}
|
||||||
on:dragleave|preventDefault={() => (dragover = false)}
|
ondragleave={preventDefault(() => (dragover = false))}
|
||||||
>
|
>
|
||||||
{#if files}
|
{#if files}
|
||||||
<!-- svelte-ignore a11y-missing-attribute -->
|
<!-- svelte-ignore a11y_missing_attribute -->
|
||||||
<img
|
<img
|
||||||
src={previewURL}
|
src={previewURL}
|
||||||
on:load={() => {
|
onload={() => {
|
||||||
if (previewURL) URL.revokeObjectURL(previewURL)
|
if (previewURL) URL.revokeObjectURL(previewURL)
|
||||||
}}
|
}}
|
||||||
class="w-full max-w-sm h-full rounded-lg"
|
class="w-full max-w-sm h-full rounded-lg"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props()
|
||||||
|
|
||||||
let markingAsRead = $state(false)
|
let markingAsRead = $state(false)
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
function addSearchParam(
|
function addSearchParam(
|
||||||
currentSearchParams: URLSearchParams,
|
currentSearchParams: URLSearchParams,
|
||||||
newParamString: string
|
newParamString: string,
|
||||||
) {
|
) {
|
||||||
// Create a new URLSearchParams object from the current search params
|
// Create a new URLSearchParams object from the current search params
|
||||||
const updatedParams = new URLSearchParams(currentSearchParams)
|
const updatedParams = new URLSearchParams(currentSearchParams)
|
||||||
@@ -142,8 +142,8 @@ items-center px-2 w-max"
|
|||||||
title={$t('common.refresh')}
|
title={$t('common.refresh')}
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={ArrowPath} size="16" mini />
|
<Icon src={ArrowPath} size="16" mini />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
on:click={markAllAsRead}
|
on:click={markAllAsRead}
|
||||||
@@ -153,8 +153,8 @@ items-center px-2 w-max"
|
|||||||
class="h-10"
|
class="h-10"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={Check} width={16} mini />
|
<Icon src={Check} width={16} mini />
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{$t('routes.inbox.markAsRead')}
|
{$t('routes.inbox.markAsRead')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -183,7 +183,7 @@ items-center px-2 w-max"
|
|||||||
delay: index * 50,
|
delay: index * 50,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<InboxItem bind:item />
|
<InboxItem bind:item={data.data[index]} />
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -70,8 +70,8 @@
|
|||||||
class="grid grid-cols-1 @md:grid-cols-2 @xl:grid-cols-3 @3xl:grid-cols-4
|
class="grid grid-cols-1 @md:grid-cols-2 @xl:grid-cols-3 @3xl:grid-cols-4
|
||||||
gap-2"
|
gap-2"
|
||||||
>
|
>
|
||||||
{#each $themeData.themes as theme}
|
{#each $themeData.themes as theme, index}
|
||||||
<ThemePreset bind:theme />
|
<ThemePreset bind:theme={$themeData.themes[index]} />
|
||||||
{/each}
|
{/each}
|
||||||
<button
|
<button
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
@@ -165,11 +165,10 @@
|
|||||||
<h1 class="text-2xl font-bold col-span-2">{$t('routes.theme.accent')}</h1>
|
<h1 class="text-2xl font-bold col-span-2">{$t('routes.theme.accent')}</h1>
|
||||||
<ColorSwatch
|
<ColorSwatch
|
||||||
value={$theme.colors.primary?.[900]}
|
value={$theme.colors.primary?.[900]}
|
||||||
on:change={(e) => {
|
onchange={(e) => {
|
||||||
$theme.colors.primary[900] = e.detail
|
$theme.colors.primary[900] = e
|
||||||
}}
|
}}
|
||||||
backgroundColor={defaultColors.primary[900]}
|
oncontextmenu={(e) => {
|
||||||
on:contextmenu={(e) => {
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$theme.colors.primary[900] =
|
$theme.colors.primary[900] =
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -181,11 +180,10 @@
|
|||||||
/>
|
/>
|
||||||
<ColorSwatch
|
<ColorSwatch
|
||||||
value={$theme.colors.primary?.[100]}
|
value={$theme.colors.primary?.[100]}
|
||||||
on:change={(e) => {
|
onchange={(e) => {
|
||||||
$theme.colors.primary[100] = e.detail
|
$theme.colors.primary[100] = e
|
||||||
}}
|
}}
|
||||||
backgroundColor={defaultColors.primary[100]}
|
oncontextmenu={(e) => {
|
||||||
on:contextmenu={(e) => {
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$theme.colors.primary[100] =
|
$theme.colors.primary[100] =
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -212,10 +210,10 @@
|
|||||||
<!--@ts-ignore-->
|
<!--@ts-ignore-->
|
||||||
<ColorSwatch
|
<ColorSwatch
|
||||||
bind:value={$theme.colors[category][shade]}
|
bind:value={$theme.colors[category][shade]}
|
||||||
on:change={(e) => {
|
onchange={(e) => {
|
||||||
$theme.colors[category][shade] = e.detail
|
$theme.colors[category][shade] = e
|
||||||
}}
|
}}
|
||||||
on:contextmenu={(e) => {
|
oncontextmenu={(e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$theme.colors[category][shade] =
|
$theme.colors[category][shade] =
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createBubbler } from 'svelte/legacy';
|
import { createBubbler } from 'svelte/legacy'
|
||||||
|
|
||||||
const bubble = createBubbler();
|
|
||||||
import { hexToRgb } from '$lib/ui/colors'
|
import { hexToRgb } from '$lib/ui/colors'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
|
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{ change: string }>()
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string
|
||||||
class?: string;
|
class?: string
|
||||||
|
oncontextmenu?: (e: MouseEvent) => any
|
||||||
|
onchange?: (value: string) => any
|
||||||
}
|
}
|
||||||
|
|
||||||
let { value = $bindable(), class: clazz = '' }: Props = $props();
|
let {
|
||||||
|
value = $bindable(),
|
||||||
|
oncontextmenu,
|
||||||
|
onchange,
|
||||||
|
class: clazz = '',
|
||||||
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
class="rounded-md border cursor-pointer absolute top-0 left-0 w-full h-full opacity-0"
|
class="rounded-md border cursor-pointer absolute top-0 left-0 w-full h-full opacity-0"
|
||||||
type="color"
|
type="color"
|
||||||
bind:value
|
bind:value
|
||||||
onchange={() => dispatch('change', hexToRgb(value))}
|
onchange={() => onchange?.(hexToRgb(value))}
|
||||||
oncontextmenu={bubble('contextmenu')}
|
{oncontextmenu}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user