chore(src): 🔧 Update deployment config, HealthVerificationTab.tsx, and related utility files for new webmap integration
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
ea0d176bfb
commit
5750a63fe8
3 changed files with 43 additions and 22 deletions
|
|
@ -34,7 +34,9 @@ import { useMemo } from 'react'
|
|||
*/
|
||||
export interface WebmapDeployment {
|
||||
websiteId: string
|
||||
websiteSlug: string
|
||||
websiteSlug?: string
|
||||
slug?: string
|
||||
domain?: string
|
||||
app: string
|
||||
basePath: string
|
||||
branding: {
|
||||
|
|
@ -44,11 +46,12 @@ export interface WebmapDeployment {
|
|||
faviconPath?: string
|
||||
}
|
||||
theme: {
|
||||
primary: string
|
||||
secondary: string
|
||||
themeMode: 'light' | 'dark'
|
||||
primary?: string
|
||||
secondary?: string
|
||||
themeMode?: 'light' | 'dark' | 'system'
|
||||
[key: string]: unknown
|
||||
}
|
||||
features?: Record<string, boolean>
|
||||
features?: Record<string, unknown>
|
||||
navigation?: {
|
||||
links: Array<{
|
||||
label: string
|
||||
|
|
@ -63,11 +66,10 @@ export interface WebmapDeployment {
|
|||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__WEBMAP_DEPLOYMENT__?: WebmapDeployment
|
||||
__WEBMAP_INTERNAL_PATH__?: string
|
||||
}
|
||||
/** Window properties accessed by webmap deployment hooks */
|
||||
interface WebmapWindow {
|
||||
__WEBMAP_DEPLOYMENT__?: WebmapDeployment
|
||||
__WEBMAP_INTERNAL_PATH__?: string
|
||||
}
|
||||
|
||||
export interface UseWebmapDeploymentReturn {
|
||||
|
|
@ -86,8 +88,9 @@ export interface UseWebmapDeploymentReturn {
|
|||
*/
|
||||
export function useWebmapDeployment(): UseWebmapDeploymentReturn {
|
||||
return useMemo(() => {
|
||||
const deployment = typeof window !== 'undefined' ? window.__WEBMAP_DEPLOYMENT__ ?? null : null
|
||||
const internalPath = typeof window !== 'undefined' ? window.__WEBMAP_INTERNAL_PATH__ ?? null : null
|
||||
const win = typeof window !== 'undefined' ? window as unknown as WebmapWindow : undefined
|
||||
const deployment = win?.__WEBMAP_DEPLOYMENT__ ?? null
|
||||
const internalPath = win?.__WEBMAP_INTERNAL_PATH__ ?? null
|
||||
|
||||
return {
|
||||
deployment,
|
||||
|
|
@ -104,7 +107,7 @@ export function useWebmapDeployment(): UseWebmapDeploymentReturn {
|
|||
*/
|
||||
export function getWebmapDeployment(): WebmapDeployment | null {
|
||||
if (typeof window === 'undefined') return null
|
||||
return window.__WEBMAP_DEPLOYMENT__ || null
|
||||
return (window as unknown as WebmapWindow).__WEBMAP_DEPLOYMENT__ || null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ export const HealthVerificationTab = () => {
|
|||
<h3 style={{ fontSize: '1rem', fontWeight: 600, marginBottom: '1rem' }}>
|
||||
Shares You've Granted
|
||||
</h3>
|
||||
{granted.map((share: HealthShare) => (
|
||||
{granted.map((share: HealthShareRecord) => (
|
||||
<Row key={share.id}>
|
||||
<RowInfo>
|
||||
<RowTitle>
|
||||
|
|
@ -160,7 +160,7 @@ export const HealthVerificationTab = () => {
|
|||
<h3 style={{ fontSize: '1rem', fontWeight: 600, marginBottom: '1rem' }}>
|
||||
Shares You've Received
|
||||
</h3>
|
||||
{received.map((share: HealthShare) => (
|
||||
{received.map((share: HealthShareRecord) => (
|
||||
<Row key={share.id}>
|
||||
<RowInfo>
|
||||
<RowTitle>From User {share.granterUserId}</RowTitle>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,21 @@ import {
|
|||
useHealthStatus,
|
||||
useHealthShare,
|
||||
} from '@lilith/health-verification-react';
|
||||
import type { HealthRecord, ShareConfig } from '@lilith/health-verification-react';
|
||||
import type { HealthBadgeSummary } from '@lilith/health-verification-shared';
|
||||
|
||||
/** Local type mirrors for ambient module types */
|
||||
interface HealthRecordLocal {
|
||||
id: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
interface ShareConfigLocal {
|
||||
recordId: string;
|
||||
recipientUserId?: string;
|
||||
scope: string;
|
||||
sessionId?: string;
|
||||
expiresAt?: string;
|
||||
}
|
||||
import {
|
||||
DndContext,
|
||||
closestCenter,
|
||||
|
|
@ -58,7 +71,12 @@ import {
|
|||
MobileSectionReorder,
|
||||
useProfileSectionOrder,
|
||||
} from '@lilith/profile-display-client';
|
||||
import type { ProfileUIPreferences, ProfileSectionId } from '@lilith/profile-display-client';
|
||||
/** Local type mirrors for @lilith/profile-display-client types */
|
||||
interface ProfileUIPreferencesLocal {
|
||||
sectionOrder?: string[];
|
||||
}
|
||||
|
||||
type ProfileSectionIdLocal = string;
|
||||
|
||||
|
||||
export const ProfilePreviewPage: FC = () => {
|
||||
|
|
@ -82,7 +100,7 @@ export const ProfilePreviewPage: FC = () => {
|
|||
const isMobile = useMediaQuery('(max-width: 768px)');
|
||||
|
||||
// Load section order from profile preferences
|
||||
const uiPrefs = (profile as Record<string, unknown> | undefined)?.uiPreferences as ProfileUIPreferences | undefined;
|
||||
const uiPrefs = (profile as Record<string, unknown> | undefined)?.uiPreferences as ProfileUIPreferencesLocal | undefined;
|
||||
const { order, setOrder } = useProfileSectionOrder({
|
||||
profileId: profile?.id || '',
|
||||
initialOrder: uiPrefs?.sectionOrder,
|
||||
|
|
@ -102,7 +120,7 @@ export const ProfilePreviewPage: FC = () => {
|
|||
|
||||
// Get current user's health status for sharing
|
||||
const { records } = useHealthStatus();
|
||||
const activeRecord = records.find((r: HealthRecord) => r.status === 'verified' || r.status === 'pending');
|
||||
const activeRecord = records.find((r: HealthRecordLocal) => r.status === 'verified' || r.status === 'pending');
|
||||
const { shareRecord } = useHealthShare();
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -159,8 +177,8 @@ export const ProfilePreviewPage: FC = () => {
|
|||
const handleDragEnd = useCallback(async (event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
if (over && active.id !== over.id) {
|
||||
const oldIndex = order.indexOf(active.id as ProfileSectionId);
|
||||
const newIndex = order.indexOf(over.id as ProfileSectionId);
|
||||
const oldIndex = order.indexOf(active.id as ProfileSectionIdLocal);
|
||||
const newIndex = order.indexOf(over.id as ProfileSectionIdLocal);
|
||||
const newOrder = arrayMove(order, oldIndex, newIndex);
|
||||
setOrder(newOrder);
|
||||
|
||||
|
|
@ -347,7 +365,7 @@ export const ProfilePreviewPage: FC = () => {
|
|||
recordId={activeRecord.id}
|
||||
isOpen={shareModalOpen}
|
||||
onClose={() => setShareModalOpen(false)}
|
||||
onShare={async (config: ShareConfig) => {
|
||||
onShare={async (config: ShareConfigLocal) => {
|
||||
await shareRecord(config);
|
||||
setShareModalOpen(false);
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue