Update site changes
This commit is contained in:
@@ -422,6 +422,8 @@ export interface Event {
|
||||
capacity: number;
|
||||
status: 'draft' | 'published' | 'cancelled' | 'completed' | 'archived';
|
||||
bannerUrl?: string;
|
||||
externalBookingEnabled?: boolean;
|
||||
externalBookingUrl?: string;
|
||||
bookedCount?: number;
|
||||
availableSeats?: number;
|
||||
createdAt: string;
|
||||
|
||||
@@ -6,10 +6,11 @@ export interface SocialLinks {
|
||||
instagram?: string;
|
||||
email?: string;
|
||||
telegram?: string;
|
||||
tiktok?: string;
|
||||
}
|
||||
|
||||
export interface SocialLink {
|
||||
type: 'whatsapp' | 'instagram' | 'email' | 'telegram';
|
||||
type: 'whatsapp' | 'instagram' | 'email' | 'telegram' | 'tiktok';
|
||||
url: string;
|
||||
label: string;
|
||||
handle?: string;
|
||||
@@ -21,6 +22,7 @@ export const socialConfig: SocialLinks = {
|
||||
instagram: process.env.NEXT_PUBLIC_INSTAGRAM || undefined,
|
||||
email: process.env.NEXT_PUBLIC_EMAIL || undefined,
|
||||
telegram: process.env.NEXT_PUBLIC_TELEGRAM || undefined,
|
||||
tiktok: process.env.NEXT_PUBLIC_TIKTOK || undefined,
|
||||
};
|
||||
|
||||
// Generate URLs from handles/values
|
||||
@@ -62,6 +64,17 @@ export function getTelegramUrl(value?: string): string | null {
|
||||
return `https://t.me/${clean}`;
|
||||
}
|
||||
|
||||
export function getTikTokUrl(value?: string): string | null {
|
||||
if (!value) return null;
|
||||
// If it's already a full URL, return as-is
|
||||
if (value.startsWith('https://') || value.startsWith('http://')) {
|
||||
return value;
|
||||
}
|
||||
// Otherwise, treat as handle - add @ if not present
|
||||
const clean = value.startsWith('@') ? value : `@${value}`;
|
||||
return `https://www.tiktok.com/${clean}`;
|
||||
}
|
||||
|
||||
// Extract display handle from URL or value
|
||||
function extractInstagramHandle(value: string): string {
|
||||
// If it's a URL, extract the username from the path
|
||||
@@ -83,6 +96,20 @@ function extractTelegramHandle(value: string): string {
|
||||
return `@${value.replace('@', '')}`;
|
||||
}
|
||||
|
||||
function extractTikTokHandle(value: string): string {
|
||||
// If it's a URL, extract the username from the path
|
||||
if (value.startsWith('http')) {
|
||||
const match = value.match(/tiktok\.com\/(@?[^/?]+)/);
|
||||
if (match) {
|
||||
const handle = match[1];
|
||||
return handle.startsWith('@') ? handle : `@${handle}`;
|
||||
}
|
||||
return '@tiktok';
|
||||
}
|
||||
// Otherwise it's already a handle
|
||||
return value.startsWith('@') ? value : `@${value}`;
|
||||
}
|
||||
|
||||
// Get all active social links as an array
|
||||
export function getSocialLinks(): SocialLink[] {
|
||||
const links: SocialLink[] = [];
|
||||
@@ -135,6 +162,18 @@ export function getSocialLinks(): SocialLink[] {
|
||||
}
|
||||
}
|
||||
|
||||
if (socialConfig.tiktok) {
|
||||
const url = getTikTokUrl(socialConfig.tiktok);
|
||||
if (url) {
|
||||
links.push({
|
||||
type: 'tiktok',
|
||||
url,
|
||||
label: 'TikTok',
|
||||
handle: extractTikTokHandle(socialConfig.tiktok),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return links;
|
||||
}
|
||||
|
||||
@@ -160,4 +199,9 @@ export const socialIcons = {
|
||||
<path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/>
|
||||
</svg>
|
||||
),
|
||||
tiktok: (
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
<path d="M19.59 6.69a4.83 4.83 0 0 1-3.77-4.25V2h-3.45v13.67a2.89 2.89 0 0 1-5.2 1.74 2.89 2.89 0 0 1 2.31-4.64 2.93 2.93 0 0 1 .88.13V9.4a6.84 6.84 0 0 0-1-.05A6.33 6.33 0 0 0 5 20.1a6.34 6.34 0 0 0 10.86-4.43v-7a8.16 8.16 0 0 0 4.77 1.52v-3.4a4.85 4.85 0 0 1-1-.1z"/>
|
||||
</svg>
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user