mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 17:19:40 +02:00
fix(manacore): replace hardcoded localhost URLs with APP_URLS in all widgets
All 6 remaining widgets now use APP_URLS from shared-branding for dev/prod-aware URL resolution instead of hardcoded localhost ports: - CalendarEventsWidget → APP_URLS.calendar - ChatRecentWidget → APP_URLS.chat - ClockTimersWidget → APP_URLS.clock - ManadeckProgressWidget → APP_URLS.manadeck - PictureRecentWidget → APP_URLS.picture - StorageUsageWidget → APP_URLS.storage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e2f144962c
commit
7f7c6e6fde
6 changed files with 36 additions and 12 deletions
|
|
@ -8,6 +8,10 @@
|
|||
import { calendarService, type CalendarEvent } from '$lib/api/services';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const calendarUrl = isDev ? APP_URLS.calendar.dev : APP_URLS.calendar.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let data = $state<CalendarEvent[]>([]);
|
||||
|
|
@ -119,7 +123,7 @@
|
|||
|
||||
{#if remainingCount > 0}
|
||||
<a
|
||||
href="http://localhost:5179"
|
||||
href={calendarUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="block rounded-lg py-2 text-center text-sm text-primary hover:bg-primary/5"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
import { chatService, type Conversation } from '$lib/api/services';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const chatUrl = isDev ? APP_URLS.chat.dev : APP_URLS.chat.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let data = $state<Conversation[]>([]);
|
||||
|
|
@ -80,7 +84,7 @@
|
|||
{$_('dashboard.widgets.chat.empty')}
|
||||
</p>
|
||||
<a
|
||||
href="http://localhost:5174"
|
||||
href={chatUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="mt-3 inline-block rounded-lg bg-primary/10 px-4 py-2 text-sm font-medium text-primary hover:bg-primary/20"
|
||||
|
|
@ -92,7 +96,7 @@
|
|||
<div class="space-y-2">
|
||||
{#each data as conversation}
|
||||
<a
|
||||
href="http://localhost:5174/chat/{conversation.id}"
|
||||
href="{chatUrl}/chat/{conversation.id}"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="flex items-center gap-3 rounded-lg p-2 transition-colors hover:bg-surface-hover"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
import { clockService, type Timer, type Alarm, type ClockStats } from '$lib/api/services';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const clockUrl = isDev ? APP_URLS.clock.dev : APP_URLS.clock.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let timers = $state<Timer[]>([]);
|
||||
|
|
@ -90,7 +94,7 @@
|
|||
{$_('dashboard.widgets.clock.empty')}
|
||||
</p>
|
||||
<a
|
||||
href="http://localhost:5177"
|
||||
href={clockUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="mt-3 inline-block rounded-lg bg-primary/10 px-4 py-2 text-sm font-medium text-primary hover:bg-primary/20"
|
||||
|
|
@ -174,7 +178,7 @@
|
|||
|
||||
<div class="mt-3 text-center">
|
||||
<a
|
||||
href="http://localhost:5177"
|
||||
href={clockUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="text-sm text-primary hover:underline"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
import { manadeckService, type LearningProgress, type Deck } from '$lib/api/services';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const manadeckUrl = isDev ? APP_URLS.manadeck.dev : APP_URLS.manadeck.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let progress = $state<LearningProgress | null>(null);
|
||||
|
|
@ -80,7 +84,7 @@
|
|||
{$_('dashboard.widgets.manadeck.empty')}
|
||||
</p>
|
||||
<a
|
||||
href="http://localhost:5176"
|
||||
href={manadeckUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="mt-3 inline-block rounded-lg bg-primary/10 px-4 py-2 text-sm font-medium text-primary hover:bg-primary/20"
|
||||
|
|
@ -124,7 +128,7 @@
|
|||
<div class="space-y-2">
|
||||
{#each decksWithDue as deck}
|
||||
<a
|
||||
href="http://localhost:5176/deck/{deck.id}/study"
|
||||
href="{manadeckUrl}/deck/{deck.id}/study"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="flex items-center justify-between rounded-lg p-2 transition-colors hover:bg-surface-hover"
|
||||
|
|
@ -144,7 +148,7 @@
|
|||
{#if totalDue > 0}
|
||||
<div class="mt-3 text-center">
|
||||
<a
|
||||
href="http://localhost:5176/study"
|
||||
href="{manadeckUrl}/study"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="inline-block rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
import { pictureService, type GeneratedImage } from '$lib/api/services';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const pictureUrl = isDev ? APP_URLS.picture.dev : APP_URLS.picture.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let data = $state<GeneratedImage[]>([]);
|
||||
|
|
@ -85,7 +89,7 @@
|
|||
{$_('dashboard.widgets.picture.empty')}
|
||||
</p>
|
||||
<a
|
||||
href="http://localhost:5175"
|
||||
href={pictureUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="mt-3 inline-block rounded-lg bg-primary/10 px-4 py-2 text-sm font-medium text-primary hover:bg-primary/20"
|
||||
|
|
@ -97,7 +101,7 @@
|
|||
<div class="grid grid-cols-3 gap-2">
|
||||
{#each data as image}
|
||||
<a
|
||||
href="http://localhost:5175/gallery/{image.id}"
|
||||
href="{pictureUrl}/gallery/{image.id}"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="group relative aspect-square overflow-hidden rounded-lg bg-surface-hover"
|
||||
|
|
@ -120,7 +124,7 @@
|
|||
</div>
|
||||
<div class="mt-3 text-center">
|
||||
<a
|
||||
href="http://localhost:5175/gallery"
|
||||
href="{pictureUrl}/gallery"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="text-sm text-primary hover:underline"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
import { storageService, type StorageStats } from '$lib/api/services/storage';
|
||||
import WidgetSkeleton from '../WidgetSkeleton.svelte';
|
||||
import WidgetError from '../WidgetError.svelte';
|
||||
import { APP_URLS } from '@manacore/shared-branding';
|
||||
|
||||
const isDev = typeof window !== 'undefined' && window.location.hostname === 'localhost';
|
||||
const storageUrl = isDev ? APP_URLS.storage.dev : APP_URLS.storage.prod;
|
||||
|
||||
let state = $state<'loading' | 'success' | 'error'>('loading');
|
||||
let data = $state<StorageStats | null>(null);
|
||||
|
|
@ -99,7 +103,7 @@
|
|||
{/if}
|
||||
|
||||
<a
|
||||
href="https://storage.mana.how"
|
||||
href={storageUrl}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="mt-2 block w-full rounded-lg bg-primary/10 py-2 text-center text-sm font-medium text-primary hover:bg-primary/20"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue