mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 11:39:16 +01:00
feat: ✨ Implement proper login and logout using UI
This commit is contained in:
parent
e0c41bb9b5
commit
3c8093a3d2
23 changed files with 273 additions and 193 deletions
|
|
@ -55,7 +55,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Status } from '~/types/mastodon/status';
|
||||
import type { Status } from "~/types/mastodon/status";
|
||||
|
||||
const props = defineProps<{
|
||||
note?: Status;
|
||||
|
|
|
|||
|
|
@ -91,19 +91,30 @@ const props = defineProps<{
|
|||
|
||||
// Handle reblogs
|
||||
const note = computed(() => props.note?.reblog ?? props.note);
|
||||
const noteClosed = ref(note.value?.sensitive || !!note.value?.spoiler_text || false);
|
||||
const noteClosed = ref(
|
||||
note.value?.sensitive || !!note.value?.spoiler_text || false,
|
||||
);
|
||||
|
||||
const { copy } = useClipboard();
|
||||
const client = useMegalodon();
|
||||
const mentions = await useResolveMentions(note.value?.mentions ?? [], client);
|
||||
const eventualReblogAccountName = props.note?.reblog ? (useParsedContent(props.note?.account.display_name, props.note?.account.emojis, mentions.value)).value : null;
|
||||
const mentions = await useResolveMentions(
|
||||
note.value?.mentions ?? [],
|
||||
client.value,
|
||||
);
|
||||
const eventualReblogAccountName = props.note?.reblog
|
||||
? useParsedContent(
|
||||
props.note?.account.display_name,
|
||||
props.note?.account.emojis,
|
||||
mentions.value,
|
||||
).value
|
||||
: null;
|
||||
const content =
|
||||
note.value && process.client
|
||||
? useParsedContent(
|
||||
note.value.content,
|
||||
note.value.emojis,
|
||||
mentions.value,
|
||||
)
|
||||
note.value.content,
|
||||
note.value.emojis,
|
||||
mentions.value,
|
||||
)
|
||||
: "";
|
||||
const numberFormat = (number = 0) =>
|
||||
new Intl.NumberFormat(undefined, {
|
||||
|
|
|
|||
|
|
@ -20,48 +20,52 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { Notification } from '~/types/mastodon/notification';
|
||||
import type { Notification } from "~/types/mastodon/notification";
|
||||
|
||||
const props = defineProps<{
|
||||
notification?: Notification;
|
||||
}>();
|
||||
|
||||
const accountName = useParsedContent(props.notification?.account?.display_name ?? '', props.notification?.account?.emojis ?? [], []);
|
||||
const accountName = useParsedContent(
|
||||
props.notification?.account?.display_name ?? "",
|
||||
props.notification?.account?.emojis ?? [],
|
||||
[],
|
||||
);
|
||||
const text = computed(() => {
|
||||
if (!props.notification) return '';
|
||||
if (!props.notification) return "";
|
||||
|
||||
switch (props.notification.type) {
|
||||
case 'mention':
|
||||
return 'mentioned you';
|
||||
case 'reblog':
|
||||
return 'reblogged your note';
|
||||
case 'favourite':
|
||||
return 'liked your note';
|
||||
case 'follow':
|
||||
return 'followed you';
|
||||
case 'follow_request':
|
||||
return 'requested to follow you';
|
||||
case "mention":
|
||||
return "mentioned you";
|
||||
case "reblog":
|
||||
return "reblogged your note";
|
||||
case "favourite":
|
||||
return "liked your note";
|
||||
case "follow":
|
||||
return "followed you";
|
||||
case "follow_request":
|
||||
return "requested to follow you";
|
||||
default:
|
||||
console.error('Unknown notification type', props.notification.type)
|
||||
return '';
|
||||
console.error("Unknown notification type", props.notification.type);
|
||||
return "";
|
||||
}
|
||||
});
|
||||
const icon = computed(() => {
|
||||
if (!props.notification) return '';
|
||||
if (!props.notification) return "";
|
||||
|
||||
switch (props.notification.type) {
|
||||
case 'mention':
|
||||
return 'tabler:at';
|
||||
case 'reblog':
|
||||
return 'tabler:repeat';
|
||||
case 'favourite':
|
||||
return 'tabler:heart';
|
||||
case 'follow':
|
||||
return 'tabler:plus';
|
||||
case 'follow_request':
|
||||
return 'tabler:plus';
|
||||
case "mention":
|
||||
return "tabler:at";
|
||||
case "reblog":
|
||||
return "tabler:repeat";
|
||||
case "favourite":
|
||||
return "tabler:heart";
|
||||
case "follow":
|
||||
return "tabler:plus";
|
||||
case "follow_request":
|
||||
return "tabler:plus";
|
||||
default:
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
@ -115,29 +115,27 @@ watch(
|
|||
skeleton,
|
||||
async () => {
|
||||
if (skeleton.value) return;
|
||||
parsedNote.value = (
|
||||
parsedNote.value =
|
||||
useParsedContent(
|
||||
props.account?.note ?? "",
|
||||
props.account?.emojis ?? [],
|
||||
[],
|
||||
)
|
||||
).value ?? "";
|
||||
parsedFields.value = props.account?.fields.map((field) => ({
|
||||
name: (
|
||||
useParsedContent(
|
||||
field.name,
|
||||
props.account?.emojis ?? [],
|
||||
[],
|
||||
)
|
||||
).value ?? "",
|
||||
value: (
|
||||
useParsedContent(
|
||||
field.value,
|
||||
props.account?.emojis ?? [],
|
||||
[],
|
||||
)
|
||||
).value ?? "",
|
||||
})) ?? [];
|
||||
).value ?? "";
|
||||
parsedFields.value =
|
||||
props.account?.fields.map((field) => ({
|
||||
name:
|
||||
useParsedContent(
|
||||
field.name,
|
||||
props.account?.emojis ?? [],
|
||||
[],
|
||||
).value ?? "",
|
||||
value:
|
||||
useParsedContent(
|
||||
field.value,
|
||||
props.account?.emojis ?? [],
|
||||
[],
|
||||
).value ?? "",
|
||||
})) ?? [];
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue