feat(frontend): report profile page
This commit is contained in:
parent
05913a3b2f
commit
bd21eeebcf
9 changed files with 268 additions and 12 deletions
|
@ -0,0 +1,12 @@
|
|||
<script lang="ts">
|
||||
import { t } from "$lib/i18n";
|
||||
|
||||
type Props = { required?: boolean };
|
||||
let { required }: Props = $props();
|
||||
</script>
|
||||
|
||||
{#if required}
|
||||
<small class="text-danger"><abbr title={$t("form.required")}>*</abbr></small>
|
||||
{:else}
|
||||
<small class="text-body-secondary">{$t("form.optional")}</small>
|
||||
{/if}
|
|
@ -0,0 +1,36 @@
|
|||
<script lang="ts">
|
||||
import type { MeUser } from "$api/models";
|
||||
import { PUBLIC_BASE_URL, PUBLIC_SHORT_URL } from "$env/static/public";
|
||||
import { t } from "$lib/i18n";
|
||||
|
||||
type Props = {
|
||||
user: string;
|
||||
member?: string;
|
||||
sid: string;
|
||||
reportUrl: string;
|
||||
meUser: MeUser | null;
|
||||
};
|
||||
|
||||
let { user, member, sid, reportUrl, meUser }: Props = $props();
|
||||
|
||||
let profileUrl = $derived(
|
||||
member ? `${PUBLIC_BASE_URL}/@${user}/${member}` : `${PUBLIC_BASE_URL}/@${user}`,
|
||||
);
|
||||
let shortUrl = $derived(`${PUBLIC_SHORT_URL}/${sid}`);
|
||||
|
||||
const copyUrl = async (url: string) => {
|
||||
await navigator.clipboard.writeText(url);
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-outline-secondary" onclick={() => copyUrl(profileUrl)}>
|
||||
{$t("profile.copy-link-button")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary" onclick={() => copyUrl(shortUrl)}>
|
||||
{$t("profile.copy-short-link-button")}
|
||||
</button>
|
||||
{#if meUser && meUser.username !== user}
|
||||
<a class="btn btn-outline-danger" href={reportUrl}>{$t("profile.report-button")}</a>
|
||||
{/if}
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue