Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 24 additions & 104 deletions apps/desktop/app/error.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import type { NuxtError } from "#app";
import { ArrowLeft, Home, RefreshCw, ServerOff } from "@lucide/vue";
import { ServerOff } from "@lucide/vue";
import { ErrorView } from "#console/components/shared";
import { Button } from "#console/components/ui/button";
import ThemeToggle from "#console/components/layout/footer/ThemeToggle.vue";
import AppTitlebar from "~/components/AppTitlebar.vue";
Expand All @@ -24,54 +25,13 @@ const isUnreachable = computed(
// The server the app is pointed at, to name in the unreachable message.
const serverLabel = computed(() => override.value ?? defaultUrl);

const errorConfig = computed(() => {
const code = props.error?.statusCode || 500;
if (code === 404)
return {
title: t("error.notFound.title"),
description: t("error.notFound.description"),
};
if (code === 403)
return {
title: t("error.forbidden.title"),
description: t("error.forbidden.description"),
};
if (code === 401)
return {
title: t("error.unauthorized.title"),
description: t("error.unauthorized.description"),
};
if (code >= 500)
return {
title: t("error.server.title"),
description: t("error.server.description"),
};
return {
title: t("error.generic.title"),
description: props.error?.message || t("error.generic.description"),
};
});

function handleGoBack(): void {
if (window.history.length > 1) window.history.back();
else clearError({ redirect: "/" });
}

function handleRefresh(): void {
window.location.reload();
}

// Retry a reachable-server attempt without a full webview reload (which flashes
// the whole page white). Clearing the error re-mounts the shell, whose workspace
// query re-runs against the server — the actual thing that failed.
function handleTryAgain(): void {
clearError({ redirect: "/" });
}

function handleGoHome(): void {
clearError({ redirect: "/" });
}

// Take the user to the login screen, where the Server URL field and the
// pre-flight "Check server" check live — the place to re-check or change the URL.
//
Expand All @@ -97,77 +57,37 @@ function handleServerSettings(): void {
<ThemeToggle />
</header>

<main class="flex flex-1 items-center justify-center px-4">
<main class="flex flex-1 items-center justify-center px-4 pb-24">
<!-- Server unreachable: the self-hosted server isn't answering. Named, with
the actions that resolve it — not a dead status code. -->
<div
v-if="isUnreachable"
class="max-w-sm space-y-6 text-center"
>
<div class="flex justify-center">
<div class="rounded-full bg-muted p-4 text-muted-foreground">
<ServerOff :size="32" />
</div>
</div>

<div class="space-y-2">
<h1 class="text-2xl font-semibold tracking-tight">
{{ t("error.unreachable.title") }}
</h1>
<p class="text-sm text-muted-foreground">
{{ t("error.unreachable.description") }}
</p>
<p class="font-mono text-xs text-muted-foreground/80">
{{ serverLabel }}
</p>
</div>

<div class="flex flex-col items-center justify-center gap-3 sm:flex-row">
<Button
variant="outline"
class="w-full sm:w-auto"
@click="handleTryAgain"
>
<RefreshCw :size="16" class="mr-2" />
<div v-if="isUnreachable" class="w-full max-w-sm text-center">
<ServerOff
:size="24"
:stroke-width="1.5"
class="mx-auto text-muted-foreground"
aria-hidden="true"
/>
<h1 class="mt-3 text-[17px] font-semibold tracking-tight text-foreground">
{{ t("serverUnreachable.title") }}
</h1>
<p class="mt-1.5 text-[13px] text-muted-foreground">
{{ t("serverUnreachable.description") }}
</p>
<p class="mt-2 truncate font-mono text-xs text-muted-foreground/80">
{{ serverLabel }}
</p>
<div class="mt-6 flex flex-wrap items-center justify-center gap-2">
<Button variant="outline" size="sm" @click="handleTryAgain">
{{ t("error.actions.retry") }}
</Button>
<Button class="w-full sm:w-auto" @click="handleServerSettings">
<ServerOff :size="16" class="mr-2" />
{{ t("error.actions.serverSettings") }}
<Button size="sm" @click="handleServerSettings">
{{ t("serverUnreachable.serverSettings") }}
</Button>
</div>
</div>

<!-- Generic HTTP-code error (404 / 403 / 5xx / fatal). -->
<div v-else class="max-w-sm space-y-6 text-center">
<div class="select-none text-8xl font-bold text-muted-foreground/20">
{{ error?.statusCode || 500 }}
</div>

<div class="space-y-2">
<h1 class="text-2xl font-semibold tracking-tight">
{{ errorConfig.title }}
</h1>
<p class="text-sm text-muted-foreground">
{{ errorConfig.description }}
</p>
</div>

<div class="flex flex-col items-center justify-center gap-3 sm:flex-row">
<Button variant="outline" class="w-full sm:w-auto" @click="handleGoBack">
<ArrowLeft :size="16" class="mr-2" />
{{ t("error.actions.goBack") }}
</Button>
<Button variant="outline" class="w-full sm:w-auto" @click="handleRefresh">
<RefreshCw :size="16" class="mr-2" />
{{ t("error.actions.retry") }}
</Button>
<Button class="w-full sm:w-auto" @click="handleGoHome">
<Home :size="16" class="mr-2" />
{{ t("error.actions.home") }}
</Button>
</div>
</div>
<ErrorView v-else :error="error" />
</main>
</div>
</template>
35 changes: 18 additions & 17 deletions apps/desktop/app/pages/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,17 +254,18 @@ onBeforeUnmount(() => window.removeEventListener("focus", onWindowFocus));
</header>

<main class="flex flex-1 items-center justify-center px-4">
<div class="w-full max-w-sm space-y-6">
<div class="flex flex-col items-center space-y-3 text-center">
<NvisyLogo :size="34" class="text-foreground" />
<div class="space-y-1.5">
<h1 class="text-2xl font-semibold tracking-tight">
{{ t("auth.login.connect.heading") }}
</h1>
<p class="text-sm text-muted-foreground">
{{ t("auth.login.connect.subtitle") }}
</p>
</div>
<div class="w-full max-w-[22rem] space-y-6">
<!-- The same mark and heading as the web sign-in. -->
<div class="flex flex-col items-center text-center">
<NvisyLogo :size="56" class="mb-5 text-foreground" />
<h1 class="text-xl font-medium tracking-tight text-foreground">
{{ t("auth.login.connect.heading") }}
</h1>
<p
class="mx-auto mt-2 max-w-[19rem] text-sm leading-relaxed text-muted-foreground"
>
{{ t("auth.login.connect.subtitle") }}
</p>
</div>

<!-- Server connection. Status-forward: the always-visible row leads with a
Expand Down Expand Up @@ -326,7 +327,7 @@ onBeforeUnmount(() => window.removeEventListener("focus", onWindowFocus));
type="url"
inputmode="url"
:placeholder="defaultUrl || t('auth.server.placeholder')"
class="h-10 flex-1 bg-background font-mono text-sm"
class="h-9 flex-1 bg-background font-mono text-[13px]"
autocomplete="off"
@input="onServerInput"
@change="applyServer"
Expand All @@ -338,7 +339,7 @@ onBeforeUnmount(() => window.removeEventListener("focus", onWindowFocus));
type="button"
variant="outline"
size="icon"
class="size-10 shrink-0 bg-background"
class="size-9 shrink-0 bg-background"
:disabled="probe.kind === 'checking'"
:aria-label="t('auth.server.check')"
:title="t('auth.server.check')"
Expand Down Expand Up @@ -381,19 +382,19 @@ onBeforeUnmount(() => window.removeEventListener("focus", onWindowFocus));
<div class="space-y-4">
<div
v-if="signInError"
class="rounded-lg border border-destructive/20 bg-destructive/10 p-3 text-sm text-destructive"
class="rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2 text-[13px] text-destructive"
>
{{ signInError }}
</div>

<Button
type="button"
class="h-10 w-full"
class="h-11 w-full"
:disabled="awaitingBrowser"
@click="beginBrowserSignIn"
>
<Loader2 v-if="awaitingBrowser" :size="16" class="mr-2 animate-spin" />
<ExternalLink v-else :size="16" class="mr-2" />
<Loader2 v-if="awaitingBrowser" :size="16" class="animate-spin" />
<ExternalLink v-else :size="16" />
{{
awaitingBrowser
? t("auth.login.browser.waiting")
Expand Down
37 changes: 5 additions & 32 deletions apps/desktop/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,6 @@
}
}
},
"error": {
"unreachable": {
"title": "Server nicht erreichbar",
"description": "Die App konnte keine Verbindung zu Ihrem Nvisy-Server herstellen. Er ist möglicherweise offline, startet noch oder ist unter einer anderen Adresse erreichbar."
},
"notFound": {
"title": "Seite nicht gefunden",
"description": "Diese Seite existiert nicht oder wurde verschoben."
},
"forbidden": {
"title": "Zugriff verweigert",
"description": "Sie haben keine Berechtigung, auf diese Seite zuzugreifen."
},
"unauthorized": {
"title": "Nicht angemeldet",
"description": "Bitte melden Sie sich an, um auf diese Seite zuzugreifen."
},
"server": {
"title": "Etwas ist schiefgelaufen",
"description": "Beim Laden ist ein Problem aufgetreten. Bitte versuchen Sie es erneut."
},
"generic": {
"title": "Ein Fehler ist aufgetreten",
"description": "Etwas Unerwartetes ist passiert."
},
"actions": {
"goBack": "Zurück",
"retry": "Erneut versuchen",
"home": "Startseite",
"serverSettings": "Servereinstellungen"
}
},
"tray": {
"openStudio": "Studio öffnen",
"minimizeToTray": "In die Ablage minimieren",
Expand Down Expand Up @@ -94,5 +62,10 @@
"description": "Chat und schnelle Dateiaktionen folgen in Kürze. Öffne solange die App, um loszulegen."
},
"openApp": "App öffnen"
},
"serverUnreachable": {
"title": "Server nicht erreichbar",
"description": "Die App konnte keine Verbindung zu Ihrem Nvisy-Server herstellen. Er ist möglicherweise offline, startet noch oder ist unter einer anderen Adresse erreichbar.",
"serverSettings": "Servereinstellungen"
}
}
37 changes: 5 additions & 32 deletions apps/desktop/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,38 +31,6 @@
}
}
},
"error": {
"unreachable": {
"title": "Can't reach your server",
"description": "The app couldn't connect to your Nvisy server. It may be offline, still starting, or reachable at a different address."
},
"notFound": {
"title": "Page not found",
"description": "This page doesn't exist or has been moved."
},
"forbidden": {
"title": "Access denied",
"description": "You don't have permission to access this page."
},
"unauthorized": {
"title": "Unauthorized",
"description": "Please sign in to access this page."
},
"server": {
"title": "Something went wrong",
"description": "We're having trouble loading this. Please try again."
},
"generic": {
"title": "An error occurred",
"description": "Something unexpected happened."
},
"actions": {
"goBack": "Go back",
"retry": "Try again",
"home": "Home",
"serverSettings": "Server settings"
}
},
"tray": {
"openStudio": "Open studio",
"minimizeToTray": "Minimize to tray",
Expand Down Expand Up @@ -94,5 +62,10 @@
"description": "Chat and quick file actions land here soon. For now, open the app to get started."
},
"openApp": "Open the app"
},
"serverUnreachable": {
"title": "Can't reach your server",
"description": "The app couldn't connect to your Nvisy server. It may be offline, still starting, or reachable at a different address.",
"serverSettings": "Server settings"
}
}
Loading
Loading