mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
feat(manacore/web): add share via uLoad to calendar events and contacts
Adds ShareNetwork button and ShareModal to calendar event detail and contact detail views for creating short links via shared-uload. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
23b5b8b084
commit
2105cc6cc4
2 changed files with 60 additions and 1 deletions
|
|
@ -24,7 +24,8 @@
|
|||
isToday,
|
||||
} from 'date-fns';
|
||||
import { de } from 'date-fns/locale';
|
||||
import { CaretLeft, CaretRight, Plus } from '@manacore/shared-icons';
|
||||
import { CaretLeft, CaretRight, Plus, ShareNetwork } from '@manacore/shared-icons';
|
||||
import { ShareModal } from '@manacore/shared-uload';
|
||||
|
||||
const calendarsCtx: { readonly value: Calendar[] } = getContext('calendars');
|
||||
const eventsCtx: { readonly value: CalendarEvent[] } = getContext('calendarEvents');
|
||||
|
|
@ -164,6 +165,14 @@
|
|||
showEventForm = false;
|
||||
}
|
||||
|
||||
// Share modal state
|
||||
let shareEvent = $state<CalendarEvent | null>(null);
|
||||
let shareUrl = $derived(
|
||||
shareEvent
|
||||
? `${typeof window !== 'undefined' ? window.location.origin : ''}/calendar?event=${shareEvent.id}`
|
||||
: ''
|
||||
);
|
||||
|
||||
// Hours for the week grid
|
||||
const hours = Array.from({ length: 24 }, (_, i) => i);
|
||||
|
||||
|
|
@ -540,6 +549,18 @@
|
|||
>
|
||||
Löschen
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick={() => {
|
||||
shareEvent = editingEvent;
|
||||
showEventForm = false;
|
||||
}}
|
||||
class="flex items-center gap-1.5 rounded-lg px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-muted transition-colors"
|
||||
title="Kurzlink teilen"
|
||||
>
|
||||
<ShareNetwork size={16} />
|
||||
Teilen
|
||||
</button>
|
||||
{/if}
|
||||
<div class="flex-1"></div>
|
||||
<button
|
||||
|
|
@ -562,6 +583,16 @@
|
|||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Share Modal (uLoad integration) -->
|
||||
<ShareModal
|
||||
visible={shareEvent !== null}
|
||||
onClose={() => (shareEvent = null)}
|
||||
url={shareUrl}
|
||||
title={shareEvent?.title ?? ''}
|
||||
source="calendar"
|
||||
description={shareEvent?.location ? `Ort: ${shareEvent.location}` : ''}
|
||||
/>
|
||||
|
||||
<style>
|
||||
.week-grid {
|
||||
min-height: 100%;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@
|
|||
MapPin,
|
||||
Cake,
|
||||
Note,
|
||||
ShareNetwork,
|
||||
} from '@manacore/shared-icons';
|
||||
import { ShareModal } from '@manacore/shared-uload';
|
||||
|
||||
const allContacts$: Observable<Contact[]> = getContext('contacts');
|
||||
|
||||
|
|
@ -78,6 +80,15 @@
|
|||
await contactsStore.deleteContact(contact.id);
|
||||
goto('/contacts');
|
||||
}
|
||||
|
||||
// Share modal
|
||||
let showShare = $state(false);
|
||||
let shareUrl = $derived(
|
||||
contact
|
||||
? `${typeof window !== 'undefined' ? window.location.origin : ''}/contacts/${contact.id}`
|
||||
: ''
|
||||
);
|
||||
let shareTitle = $derived(contact ? getDisplayName(contact) : '');
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
|
@ -143,6 +154,13 @@
|
|||
|
||||
<!-- Actions -->
|
||||
<div class="flex gap-1">
|
||||
<button
|
||||
onclick={() => (showShare = true)}
|
||||
class="rounded-lg p-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
title="Kurzlink teilen"
|
||||
>
|
||||
<ShareNetwork size={18} />
|
||||
</button>
|
||||
<button
|
||||
onclick={() => startEdit()}
|
||||
class="rounded-lg p-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
||||
|
|
@ -368,3 +386,13 @@
|
|||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Share Modal (uLoad integration) -->
|
||||
<ShareModal
|
||||
visible={showShare}
|
||||
onClose={() => (showShare = false)}
|
||||
url={shareUrl}
|
||||
title={shareTitle}
|
||||
source="contacts"
|
||||
description={contact?.company ? `${contact.jobTitle ?? ''} @ ${contact.company}`.trim() : ''}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue