feat: Add support for accounts on other instances

This commit is contained in:
Jesse Wierzbinski 2025-01-29 04:39:33 +01:00
parent 18eee4d481
commit 29b4cb43ca
No known key found for this signature in database
13 changed files with 179 additions and 40 deletions

View file

@ -3,7 +3,7 @@ export type ConfirmModalOptions = {
message?: string;
confirmText?: string;
cancelText?: string;
inputType?: "none" | "text" | "textarea";
inputType?: "none" | "text" | "textarea" | "url";
defaultValue?: string;
};

View file

@ -10,7 +10,7 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Input, UrlInput } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import * as m from "~/paraglide/messages.js";
import {
@ -32,6 +32,8 @@ const resolvePromise = ref<((result: ConfirmModalResult) => void) | null>(null);
function open(options: ConfirmModalOptions): Promise<ConfirmModalResult> {
isOpen.value = true;
isValid.value = false;
modalOptions.value = {
title: options.title || m.antsy_whole_alligator_blink(),
message: options.message,
@ -68,6 +70,8 @@ function handleCancel() {
confirmModalService.register({
open,
});
const isValid = ref(false);
</script>
<template>
@ -82,6 +86,8 @@ confirmModalService.register({
<Input v-if="modalOptions.inputType === 'text'" v-model="inputValue" />
<UrlInput v-if="modalOptions.inputType === 'url'" v-model="inputValue" placeholder="google.com" v-model:is-valid="isValid" />
<Textarea v-else-if="modalOptions.inputType === 'textarea'" v-model="inputValue" rows="6" />
<AlertDialogFooter class="w-full">
@ -91,11 +97,11 @@ confirmModalService.register({
</Button>
</AlertDialogCancel>
<AlertDialogAction :as-child="true">
<Button @click="handleConfirm">
<Button @click="handleConfirm" :disabled="!isValid && modalOptions.inputType === 'url'">
{{ modalOptions.confirmText }}
</Button>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>
</template>