mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f8fe50e65 | ||
|
|
7d58595f58 | ||
|
|
84d392d07a | ||
|
|
67b611a6b8 | ||
|
|
f37d35bf6c |
No files matched your search
@@ -137,6 +137,7 @@ const defaultConfig: AppConfig = {
|
||||
fsPathTemplates: electronPaths.fsPathTemplates,
|
||||
sentryDsn: import.meta.env.VITE_SENTRY_DSN || "",
|
||||
sentryEnabled: true,
|
||||
communityFollowPack: "nevent1qvzqqqr4xypzpyexz3t34l966ngh5xg7u2q788hthdqmj0av3lv8s2tz9t43zt6dqy28wumn8ghj7un9d3shjtnyv9kh2uewd9hsz9nhwden5te0wfjkccte9ehx7um5wghxyctwvsq3gamnwvaz7tmwdaehgu3wdau8gu3wv3jhvqgawaehxw309ahx7um5wgkhqatz9emk2mrvdaexgetj9ehx2aqpp4mhxue69uhkummn9ekx7mqpzemhxue69uhhyetvv9ujuurjd9kkzmpwdejhgqgwwaehxw309ahx7uewd3hkctcpz9mhxue69uhkummnw3ezuamfdejj7qghwaehxw309aex2mrp0yhxummnw3ezucnpdejz7qgmwaehxw309aex2mrp0yhxummnw3e8qmr9vfejucm0d5hsz8mhwden5te0dehhxarj94ex2mrp0yhxgetjv44hymmnwvhx6ef0qyt8wumn8ghj7mn0wd68yetvd96x2uewdaexwtcprfmhxue69uhhq7tjv9kkjepwve5kzar2v9nzucm0d5hszfthwden5te0dehhxarj94ex2mrp0yhxgetjv44hymmnwvhx6ef0d9hxymmc9uqzqq6casgsyhj2c29rjlcy3tu3devp3akg7j6zqr296met9gz98np3qkwsg5",
|
||||
};
|
||||
|
||||
// Initialize filesystem adapter based on environment
|
||||
|
||||
@@ -5,6 +5,7 @@ import { URLFragmentHandler } from "./components/URLFragmentHandler";
|
||||
|
||||
import Index from "./pages/Index";
|
||||
import Clone from "./pages/Clone";
|
||||
import Community from "./pages/Community";
|
||||
import Settings from "./pages/Settings";
|
||||
import Preferences from "./pages/Preferences";
|
||||
import NostrSettings from "./pages/NostrSettings";
|
||||
@@ -36,6 +37,7 @@ export function AppRouter() {
|
||||
<Route path="/" element={<Index />} />
|
||||
<Route path="/giftcard" element={<Index />} />
|
||||
<Route path="/clone" element={<Clone />} />
|
||||
<Route path="/community" element={<Community />} />
|
||||
<Route path="/oauth/github" element={<GitHubOAuth />} />
|
||||
<Route path="/oauth/netlify" element={<NetlifyOAuth />} />
|
||||
<Route path="/oauth/vercel" element={<VercelOAuth />} />
|
||||
|
||||
@@ -50,6 +50,7 @@ const AppConfigSchema = z.object({
|
||||
sentryDsn: z.string(),
|
||||
sentryEnabled: z.boolean(),
|
||||
systemPrompt: z.string(),
|
||||
communityFollowPack: z.string(),
|
||||
}) satisfies z.ZodType<AppConfig>;
|
||||
|
||||
export function AppProvider(props: AppProviderProps) {
|
||||
|
||||
@@ -128,9 +128,10 @@ describe('NoteContent', () => {
|
||||
expect(mention).toHaveClass('text-gray-500');
|
||||
expect(mention).not.toHaveClass('text-blue-500');
|
||||
|
||||
// The text should start with @ and contain a generated name (not a truncated npub)
|
||||
// The text should contain @ and a generated name (not a truncated npub)
|
||||
// Note: textContent includes the avatar fallback initials (e.g., "SW")
|
||||
const linkText = mention.textContent;
|
||||
expect(linkText).not.toMatch(/^@npub1/); // Should not be a truncated npub
|
||||
expect(linkText).toEqual("@Swift Falcon");
|
||||
expect(linkText).not.toMatch(/@npub1/); // Should not be a truncated npub
|
||||
expect(linkText).toContain("@Swift Falcon");
|
||||
});
|
||||
});
|
||||
+264
-53
@@ -2,76 +2,130 @@ import { useMemo } from 'react';
|
||||
import { type NostrEvent } from '@nostrify/nostrify';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useAuthor } from '@/hooks/useAuthor';
|
||||
import { genUserName } from '@/lib/genUserName';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
|
||||
interface NoteContentProps {
|
||||
event: NostrEvent;
|
||||
className?: string;
|
||||
/** When true, renders mentions and hashtags as styled text instead of clickable links */
|
||||
disableLinks?: boolean;
|
||||
/** When true, hides embedded note/event previews entirely */
|
||||
hideEmbeds?: boolean;
|
||||
}
|
||||
|
||||
/** Parses content of text note events so that URLs and hashtags are linkified. */
|
||||
export function NoteContent({
|
||||
event,
|
||||
className,
|
||||
}: NoteContentProps) {
|
||||
event,
|
||||
className,
|
||||
disableLinks = false,
|
||||
hideEmbeds = false,
|
||||
}: NoteContentProps) {
|
||||
// Process the content to render mentions, links, etc.
|
||||
const content = useMemo(() => {
|
||||
const text = event.content;
|
||||
|
||||
|
||||
// Regex to find URLs, Nostr references, and hashtags
|
||||
const regex = /(https?:\/\/[^\s]+)|nostr:(npub1|note1|nprofile1|nevent1)([023456789acdefghjklmnpqrstuvwxyz]+)|(#\w+)/g;
|
||||
|
||||
|
||||
const parts: React.ReactNode[] = [];
|
||||
let lastIndex = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
let keyCounter = 0;
|
||||
|
||||
|
||||
while ((match = regex.exec(text)) !== null) {
|
||||
const [fullMatch, url, nostrPrefix, nostrData, hashtag] = match;
|
||||
const index = match.index;
|
||||
|
||||
|
||||
// Add text before this match
|
||||
if (index > lastIndex) {
|
||||
parts.push(text.substring(lastIndex, index));
|
||||
}
|
||||
|
||||
|
||||
if (url) {
|
||||
// Handle URLs
|
||||
parts.push(
|
||||
<a
|
||||
key={`url-${keyCounter++}`}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{url}
|
||||
</a>
|
||||
);
|
||||
// Handle URLs - always render as links (but prevent click propagation when disableLinks)
|
||||
if (disableLinks) {
|
||||
parts.push(
|
||||
<span key={`url-${keyCounter++}`} className="text-blue-500">
|
||||
{url}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
parts.push(
|
||||
<a
|
||||
key={`url-${keyCounter++}`}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{url}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
} else if (nostrPrefix && nostrData) {
|
||||
// Handle Nostr references
|
||||
try {
|
||||
const nostrId = `${nostrPrefix}${nostrData}`;
|
||||
const decoded = nip19.decode(nostrId);
|
||||
|
||||
|
||||
if (decoded.type === 'npub') {
|
||||
const pubkey = decoded.data;
|
||||
parts.push(
|
||||
<NostrMention key={`mention-${keyCounter++}`} pubkey={pubkey} />
|
||||
<NostrMention key={`mention-${keyCounter++}`} pubkey={pubkey} disableLink={disableLinks} />
|
||||
);
|
||||
} else {
|
||||
// For other types, just show as a link
|
||||
} else if (decoded.type === 'nprofile') {
|
||||
const pubkey = decoded.data.pubkey;
|
||||
parts.push(
|
||||
<Link
|
||||
key={`nostr-${keyCounter++}`}
|
||||
to={`/${nostrId}`}
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{fullMatch}
|
||||
</Link>
|
||||
<NostrMention key={`mention-${keyCounter++}`} pubkey={pubkey} disableLink={disableLinks} />
|
||||
);
|
||||
} else if (decoded.type === 'nevent') {
|
||||
if (hideEmbeds) {
|
||||
// Skip embedded events entirely when hideEmbeds is true
|
||||
} else if (disableLinks) {
|
||||
parts.push(
|
||||
<NostrEventPreview key={`event-${keyCounter++}`} eventId={decoded.data.id} />
|
||||
);
|
||||
} else {
|
||||
parts.push(
|
||||
<NostrEventEmbed key={`event-${keyCounter++}`} eventId={decoded.data.id} />
|
||||
);
|
||||
}
|
||||
} else if (decoded.type === 'note') {
|
||||
if (hideEmbeds) {
|
||||
// Skip embedded notes entirely when hideEmbeds is true
|
||||
} else if (disableLinks) {
|
||||
parts.push(
|
||||
<NostrEventPreview key={`event-${keyCounter++}`} eventId={decoded.data} />
|
||||
);
|
||||
} else {
|
||||
parts.push(
|
||||
<NostrEventEmbed key={`event-${keyCounter++}`} eventId={decoded.data} />
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// For other types, just show as styled text or link
|
||||
if (disableLinks) {
|
||||
parts.push(
|
||||
<span key={`nostr-${keyCounter++}`} className="text-blue-500">
|
||||
{fullMatch}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
parts.push(
|
||||
<Link
|
||||
key={`nostr-${keyCounter++}`}
|
||||
to={`/${nostrId}`}
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{fullMatch}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// If decoding fails, just render as text
|
||||
@@ -79,33 +133,41 @@ export function NoteContent({
|
||||
}
|
||||
} else if (hashtag) {
|
||||
// Handle hashtags
|
||||
const tag = hashtag.slice(1); // Remove the #
|
||||
parts.push(
|
||||
<Link
|
||||
key={`hashtag-${keyCounter++}`}
|
||||
to={`/t/${tag}`}
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{hashtag}
|
||||
</Link>
|
||||
);
|
||||
if (disableLinks) {
|
||||
parts.push(
|
||||
<span key={`hashtag-${keyCounter++}`} className="text-blue-500">
|
||||
{hashtag}
|
||||
</span>
|
||||
);
|
||||
} else {
|
||||
const tag = hashtag.slice(1); // Remove the #
|
||||
parts.push(
|
||||
<Link
|
||||
key={`hashtag-${keyCounter++}`}
|
||||
to={`/t/${tag}`}
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
{hashtag}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
lastIndex = index + fullMatch.length;
|
||||
}
|
||||
|
||||
|
||||
// Add any remaining text
|
||||
if (lastIndex < text.length) {
|
||||
parts.push(text.substring(lastIndex));
|
||||
}
|
||||
|
||||
|
||||
// If no special content was found, just use the plain text
|
||||
if (parts.length === 0) {
|
||||
parts.push(text);
|
||||
}
|
||||
|
||||
|
||||
return parts;
|
||||
}, [event]);
|
||||
}, [event, disableLinks, hideEmbeds]);
|
||||
|
||||
return (
|
||||
<div className={cn("whitespace-pre-wrap break-words", className)}>
|
||||
@@ -114,24 +176,173 @@ export function NoteContent({
|
||||
);
|
||||
}
|
||||
|
||||
// Helper component to display user mentions
|
||||
function NostrMention({ pubkey }: { pubkey: string }) {
|
||||
// Helper component to display user mentions with avatar
|
||||
function NostrMention({ pubkey, disableLink = false }: { pubkey: string; disableLink?: boolean }) {
|
||||
const author = useAuthor(pubkey);
|
||||
const npub = nip19.npubEncode(pubkey);
|
||||
const hasRealName = !!author.data?.metadata?.name;
|
||||
const displayName = author.data?.metadata?.name ?? genUserName(pubkey);
|
||||
const picture = author.data?.metadata?.picture;
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<Avatar className="h-4 w-4 inline-block">
|
||||
<AvatarImage src={picture} alt={displayName} />
|
||||
<AvatarFallback className="text-[8px]">{displayName.slice(0, 2).toUpperCase()}</AvatarFallback>
|
||||
</Avatar>
|
||||
@{displayName}
|
||||
</>
|
||||
);
|
||||
|
||||
if (disableLink) {
|
||||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center gap-1 font-medium",
|
||||
hasRealName
|
||||
? "text-blue-500"
|
||||
: "text-gray-500"
|
||||
)}
|
||||
>
|
||||
{content}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Link
|
||||
<Link
|
||||
to={`/${npub}`}
|
||||
className={cn(
|
||||
"font-medium hover:underline",
|
||||
hasRealName
|
||||
? "text-blue-500"
|
||||
"inline-flex items-center gap-1 font-medium hover:underline",
|
||||
hasRealName
|
||||
? "text-blue-500"
|
||||
: "text-gray-500 hover:text-gray-700"
|
||||
)}
|
||||
>
|
||||
@{displayName}
|
||||
{content}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
// Helper component to display embedded events
|
||||
function NostrEventEmbed({ eventId }: { eventId: string }) {
|
||||
const { nostr } = useNostr();
|
||||
|
||||
const { data: event, isLoading } = useQuery({
|
||||
queryKey: ['nostr', 'event', eventId],
|
||||
queryFn: async (c) => {
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
const [event] = await nostr.query([{ ids: [eventId], limit: 1 }], { signal });
|
||||
return event;
|
||||
},
|
||||
staleTime: 300000,
|
||||
});
|
||||
|
||||
const author = useAuthor(event?.pubkey);
|
||||
const note1 = nip19.noteEncode(eventId);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="my-2 p-3 border rounded-lg bg-muted/30 animate-pulse">
|
||||
<div className="h-4 bg-muted rounded w-1/3 mb-2" />
|
||||
<div className="h-3 bg-muted rounded w-full" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!event) {
|
||||
return (
|
||||
<Link
|
||||
to={`/${note1}`}
|
||||
className="text-blue-500 hover:underline"
|
||||
>
|
||||
nostr:{note1.slice(0, 12)}...
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
const displayName = author.data?.metadata?.name ?? genUserName(event.pubkey);
|
||||
const picture = author.data?.metadata?.picture;
|
||||
const contentPreview = event.content.length > 200
|
||||
? event.content.slice(0, 200) + '...'
|
||||
: event.content;
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={`/${note1}`}
|
||||
className="block my-2 p-3 border rounded-lg bg-muted/30 hover:bg-muted/50 transition-colors no-underline"
|
||||
>
|
||||
<div className="flex items-center gap-2 mb-2">
|
||||
<Avatar className="h-5 w-5">
|
||||
<AvatarImage src={picture} alt={displayName} />
|
||||
<AvatarFallback className="text-[10px]">{displayName.slice(0, 2).toUpperCase()}</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="font-medium text-sm text-foreground">{displayName}</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{new Date(event.created_at * 1000).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground whitespace-pre-wrap break-words">
|
||||
{contentPreview}
|
||||
</p>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
// Helper component to display embedded events without links (for use inside clickable cards)
|
||||
function NostrEventPreview({ eventId }: { eventId: string }) {
|
||||
const { nostr } = useNostr();
|
||||
|
||||
const { data: event, isLoading } = useQuery({
|
||||
queryKey: ['nostr', 'event', eventId],
|
||||
queryFn: async (c) => {
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
const [event] = await nostr.query([{ ids: [eventId], limit: 1 }], { signal });
|
||||
return event;
|
||||
},
|
||||
staleTime: 300000,
|
||||
});
|
||||
|
||||
const author = useAuthor(event?.pubkey);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="my-2 p-3 border rounded-lg bg-muted/30 animate-pulse">
|
||||
<div className="h-4 bg-muted rounded w-1/3 mb-2" />
|
||||
<div className="h-3 bg-muted rounded w-full" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (!event) {
|
||||
return (
|
||||
<span className="text-blue-500">
|
||||
[quoted note]
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const displayName = author.data?.metadata?.name ?? genUserName(event.pubkey);
|
||||
const picture = author.data?.metadata?.picture;
|
||||
const contentPreview = event.content.length > 200
|
||||
? event.content.slice(0, 200) + '...'
|
||||
: event.content;
|
||||
|
||||
return (
|
||||
<div className="my-2 p-3 border rounded-lg bg-muted/30">
|
||||
<div className="flex items-center gap-2 mb-2">
|
||||
<Avatar className="h-5 w-5">
|
||||
<AvatarImage src={picture} alt={displayName} />
|
||||
<AvatarFallback className="text-[10px]">{displayName.slice(0, 2).toUpperCase()}</AvatarFallback>
|
||||
</Avatar>
|
||||
<span className="font-medium text-sm text-foreground">{displayName}</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{new Date(event.created_at * 1000).toLocaleDateString()}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground whitespace-pre-wrap break-words">
|
||||
{contentPreview}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { useEffect, useState, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, ChevronRight, Star, Columns2, X, Settings, HelpCircle, Search, Tag, Folders } from 'lucide-react';
|
||||
import { Plus, Folder, GitBranch, Loader2, ChevronDown, ChevronRight, Star, Columns2, X, Settings, HelpCircle, Search, Tag, Folders, Users } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -511,7 +511,7 @@ export function ProjectSidebar({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Settings and Help at Bottom */}
|
||||
{/* Settings, Community, and Help at Bottom */}
|
||||
<div className="border-t border-sidebar-border bg-gradient-to-r from-primary/5 to-accent/5 mt-auto pb-safe">
|
||||
<div className="p-2 flex items-center gap-2">
|
||||
<Button
|
||||
@@ -523,6 +523,15 @@ export function ProjectSidebar({
|
||||
<Settings className="h-4 w-4 transition-colors duration-200" />
|
||||
{t('settings')}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-9 w-9 p-0 text-sidebar-foreground dark:hover:text-sidebar-primary hover:bg-primary/10 dark:hover:bg-sidebar-accent/30 transition-all duration-200"
|
||||
onClick={() => navigateAndClose('/community')}
|
||||
aria-label={t('community')}
|
||||
>
|
||||
<Users className="h-4 w-4 transition-colors duration-200" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
@@ -40,6 +40,7 @@ describe('SentryProvider', () => {
|
||||
fsPathTmp: '/tmp',
|
||||
fsPathPlugins: '/plugins',
|
||||
fsPathTemplates: '/templates',
|
||||
communityFollowPack: '',
|
||||
};
|
||||
|
||||
render(
|
||||
@@ -77,6 +78,7 @@ describe('SentryProvider', () => {
|
||||
fsPathTmp: '/tmp',
|
||||
fsPathPlugins: '/plugins',
|
||||
fsPathTemplates: '/templates',
|
||||
communityFollowPack: '',
|
||||
};
|
||||
|
||||
render(
|
||||
@@ -115,6 +117,7 @@ describe('SentryProvider', () => {
|
||||
fsPathTmp: '/tmp',
|
||||
fsPathPlugins: '/plugins',
|
||||
fsPathTemplates: '/templates',
|
||||
communityFollowPack: '',
|
||||
};
|
||||
|
||||
render(
|
||||
@@ -156,6 +159,7 @@ describe('SentryProvider', () => {
|
||||
fsPathTmp: '/tmp',
|
||||
fsPathPlugins: '/plugins',
|
||||
fsPathTemplates: '/templates',
|
||||
communityFollowPack: '',
|
||||
};
|
||||
|
||||
render(
|
||||
|
||||
@@ -57,6 +57,8 @@ export interface AppConfig {
|
||||
sentryEnabled: boolean;
|
||||
/** System prompt EJS template */
|
||||
systemPrompt?: string;
|
||||
/** Nostr follow pack naddr for community events (e.g., "naddr1...") */
|
||||
communityFollowPack: string;
|
||||
}
|
||||
|
||||
export interface AppContextType {
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
import { type NostrEvent, NRelay1 } from '@nostrify/nostrify';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { useAppContext } from '@/hooks/useAppContext';
|
||||
|
||||
// ShakespeareGitCommits bot npub
|
||||
// npub1msc06u2v3y3z2awdxlc7k2tnjlc78xg8awvha5rsaphd8py7ussqd0phxu
|
||||
const COMMITS_BOT_PUBKEY = 'dc30f45e534244455d5ba6fc3b2acfc9ff2a1cd8aa31fb50c70bbfab5294f016';
|
||||
|
||||
// Shakespeare group ID for kind 9 chat messages
|
||||
const SHAKESPEARE_GROUP_ID = '41299083392805314';
|
||||
|
||||
// Shakespeare chat relay (NIP-29 group relay)
|
||||
const SHAKESPEARE_CHAT_RELAY = 'wss://chat.shakespeare.diy/';
|
||||
|
||||
// Featured testimonials - curated note IDs
|
||||
const FEATURED_TESTIMONIAL_IDS: string[] = [
|
||||
// Add hand-selected note IDs here as they are curated
|
||||
];
|
||||
|
||||
/**
|
||||
* Hook to fetch #ShakespeareDIY feed (kind 1 notes with the hashtag)
|
||||
*/
|
||||
export function useShakespeareFeed(limit = 20) {
|
||||
const { nostr } = useNostr();
|
||||
|
||||
return useQuery<NostrEvent[]>({
|
||||
queryKey: ['shakespeare-feed', limit],
|
||||
queryFn: async (c) => {
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
const events = await nostr.query(
|
||||
[{ kinds: [1], '#t': ['shakespearediy', 'ShakespeareDIY'], limit }],
|
||||
{ signal }
|
||||
);
|
||||
return events;
|
||||
},
|
||||
staleTime: 60000, // 1 minute
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to check if an event title contains "shakespeare" (case-insensitive)
|
||||
*/
|
||||
function hasShakespeareInTitle(event: NostrEvent): boolean {
|
||||
const title = event.tags.find(([name]) => name === 'title')?.[1]
|
||||
|| event.tags.find(([name]) => name === 'name')?.[1]
|
||||
|| '';
|
||||
return title.toLowerCase().includes('shakespeare');
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoded follow pack data - either from naddr or nevent
|
||||
*/
|
||||
type FollowPackData = {
|
||||
/** For naddr: query by author, kind, and d-tag */
|
||||
type: 'naddr';
|
||||
pubkey: string;
|
||||
kind: number;
|
||||
identifier: string;
|
||||
} | {
|
||||
/** For nevent: query by event id */
|
||||
type: 'nevent';
|
||||
id: string;
|
||||
relays?: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Decode a follow pack identifier (naddr or nevent) to get its components
|
||||
*/
|
||||
function decodeFollowPackIdentifier(identifier: string): FollowPackData | null {
|
||||
try {
|
||||
const decoded = nip19.decode(identifier);
|
||||
if (decoded.type === 'naddr') {
|
||||
return {
|
||||
type: 'naddr',
|
||||
pubkey: decoded.data.pubkey,
|
||||
kind: decoded.data.kind,
|
||||
identifier: decoded.data.identifier,
|
||||
};
|
||||
}
|
||||
if (decoded.type === 'nevent') {
|
||||
return {
|
||||
type: 'nevent',
|
||||
id: decoded.data.id,
|
||||
relays: decoded.data.relays,
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// Invalid identifier
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch the community follow pack to get team member pubkeys
|
||||
* Uses the communityFollowPack setting from the app config
|
||||
* Supports both naddr and nevent identifiers
|
||||
*/
|
||||
export function useCommunityFollowPack() {
|
||||
const { nostr } = useNostr();
|
||||
const { config } = useAppContext();
|
||||
|
||||
const followPackData = decodeFollowPackIdentifier(config.communityFollowPack);
|
||||
|
||||
return useQuery<string[]>({
|
||||
queryKey: ['community-follow-pack', config.communityFollowPack],
|
||||
queryFn: async (c) => {
|
||||
if (!followPackData) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
|
||||
let events: NostrEvent[];
|
||||
|
||||
if (followPackData.type === 'naddr') {
|
||||
// Query by author, kind, and d-tag for addressable events
|
||||
events = await nostr.query(
|
||||
[{
|
||||
kinds: [followPackData.kind],
|
||||
authors: [followPackData.pubkey],
|
||||
'#d': [followPackData.identifier],
|
||||
limit: 1,
|
||||
}],
|
||||
{ signal }
|
||||
);
|
||||
} else {
|
||||
// Query by event id for nevent
|
||||
events = await nostr.query(
|
||||
[{
|
||||
ids: [followPackData.id],
|
||||
limit: 1,
|
||||
}],
|
||||
{ signal }
|
||||
);
|
||||
}
|
||||
|
||||
if (events.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Extract all pubkeys from p tags
|
||||
const pubkeys = events[0].tags
|
||||
.filter(([name]) => name === 'p')
|
||||
.map(([, pubkey]) => pubkey);
|
||||
|
||||
return pubkeys;
|
||||
},
|
||||
staleTime: 300000, // 5 minutes
|
||||
enabled: !!followPackData,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch calendar events from community follow pack members (NIP-52)
|
||||
* Filtered to only show events with "shakespeare" in the title
|
||||
* Fetches both date-based (31922) and time-based (31923) calendar events
|
||||
*/
|
||||
export function useCommunityEvents(limit = 10) {
|
||||
const { nostr } = useNostr();
|
||||
const { config } = useAppContext();
|
||||
const { data: teamPubkeys } = useCommunityFollowPack();
|
||||
|
||||
return useQuery<NostrEvent[]>({
|
||||
queryKey: ['community-events', limit, config.communityFollowPack, teamPubkeys],
|
||||
queryFn: async (c) => {
|
||||
if (!teamPubkeys || teamPubkeys.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
|
||||
// Query for calendar events created by or mentioning team members
|
||||
const [createdEvents, attendingEvents] = await Promise.all([
|
||||
// Events created by team members
|
||||
nostr.query(
|
||||
[{
|
||||
kinds: [31922, 31923],
|
||||
authors: teamPubkeys,
|
||||
limit: limit * 2,
|
||||
}],
|
||||
{ signal }
|
||||
),
|
||||
// Events where team members are tagged as participants
|
||||
nostr.query(
|
||||
[{
|
||||
kinds: [31922, 31923],
|
||||
'#p': teamPubkeys,
|
||||
limit: limit * 2,
|
||||
}],
|
||||
{ signal }
|
||||
),
|
||||
]);
|
||||
|
||||
// Combine all events and filter to only include those with "shakespeare" in the title
|
||||
const allEvents = [
|
||||
...createdEvents,
|
||||
...attendingEvents,
|
||||
].filter(hasShakespeareInTitle);
|
||||
|
||||
// Deduplicate events by id
|
||||
const uniqueEvents = allEvents.filter((event, index, self) =>
|
||||
index === self.findIndex(e => e.id === event.id)
|
||||
);
|
||||
|
||||
// Filter for future events only
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
return uniqueEvents.filter(event => {
|
||||
const startTag = event.tags.find(([name]) => name === 'start')?.[1];
|
||||
if (!startTag) return false;
|
||||
|
||||
// For time-based events, start is a unix timestamp
|
||||
if (event.kind === 31923) {
|
||||
const startTime = parseInt(startTag, 10);
|
||||
return !isNaN(startTime) && startTime > now;
|
||||
}
|
||||
|
||||
// For date-based events, start is YYYY-MM-DD
|
||||
if (event.kind === 31922) {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
return startTag >= today;
|
||||
}
|
||||
|
||||
return true;
|
||||
}).sort((a, b) => {
|
||||
// Sort by start date/time
|
||||
const aStart = a.tags.find(([name]) => name === 'start')?.[1] || '';
|
||||
const bStart = b.tags.find(([name]) => name === 'start')?.[1] || '';
|
||||
return aStart.localeCompare(bStart);
|
||||
});
|
||||
},
|
||||
staleTime: 300000, // 5 minutes
|
||||
enabled: !!teamPubkeys && teamPubkeys.length > 0,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch latest commits from ShakespeareGitCommits bot (NIP-29 kind 9 chat messages)
|
||||
* Connects directly to the Shakespeare chat relay since kind 9 events are relay-specific
|
||||
*/
|
||||
export function useLatestCommits(limit = 5) {
|
||||
return useQuery<NostrEvent[]>({
|
||||
queryKey: ['latest-commits', limit],
|
||||
queryFn: async (c) => {
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
|
||||
// Connect directly to the Shakespeare chat relay for kind 9 events
|
||||
const relay = new NRelay1(SHAKESPEARE_CHAT_RELAY);
|
||||
|
||||
try {
|
||||
// Query for kind 9 chat messages from the commits bot in the Shakespeare group
|
||||
const events = await relay.query(
|
||||
[{
|
||||
kinds: [9],
|
||||
authors: [COMMITS_BOT_PUBKEY],
|
||||
'#h': [SHAKESPEARE_GROUP_ID],
|
||||
limit
|
||||
}],
|
||||
{ signal }
|
||||
);
|
||||
|
||||
return events;
|
||||
} finally {
|
||||
relay.close();
|
||||
}
|
||||
},
|
||||
staleTime: 60000, // 1 minute
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to fetch featured testimonials (hand-picked kind 1 notes)
|
||||
*/
|
||||
export function useFeaturedTestimonials() {
|
||||
const { nostr } = useNostr();
|
||||
|
||||
return useQuery<NostrEvent[]>({
|
||||
queryKey: ['featured-testimonials'],
|
||||
queryFn: async (c) => {
|
||||
if (FEATURED_TESTIMONIAL_IDS.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
|
||||
const events = await nostr.query(
|
||||
[{ kinds: [1], ids: FEATURED_TESTIMONIAL_IDS }],
|
||||
{ signal }
|
||||
);
|
||||
return events;
|
||||
},
|
||||
staleTime: 300000, // 5 minutes
|
||||
enabled: FEATURED_TESTIMONIAL_IDS.length > 0,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to extract calendar event metadata from a NostrEvent
|
||||
*/
|
||||
export function extractCalendarEventData(event: NostrEvent) {
|
||||
const tags = event.tags;
|
||||
|
||||
return {
|
||||
id: tags.find(([name]) => name === 'd')?.[1] || event.id,
|
||||
title: tags.find(([name]) => name === 'title')?.[1] || tags.find(([name]) => name === 'name')?.[1] || 'Untitled Event',
|
||||
summary: tags.find(([name]) => name === 'summary')?.[1] || '',
|
||||
description: event.content || '',
|
||||
image: tags.find(([name]) => name === 'image')?.[1],
|
||||
location: tags.find(([name]) => name === 'location')?.[1],
|
||||
start: tags.find(([name]) => name === 'start')?.[1] || '',
|
||||
end: tags.find(([name]) => name === 'end')?.[1],
|
||||
startTzid: tags.find(([name]) => name === 'start_tzid')?.[1],
|
||||
endTzid: tags.find(([name]) => name === 'end_tzid')?.[1],
|
||||
geohash: tags.find(([name]) => name === 'g')?.[1],
|
||||
hashtags: tags.filter(([name]) => name === 't').map(([, value]) => value),
|
||||
references: tags.filter(([name]) => name === 'r').map(([, value]) => value),
|
||||
kind: event.kind,
|
||||
pubkey: event.pubkey,
|
||||
created_at: event.created_at,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a calendar event date for display
|
||||
*/
|
||||
export function formatEventDate(start: string, kind: number, startTzid?: string): string {
|
||||
if (kind === 31923) {
|
||||
// Time-based event - start is unix timestamp
|
||||
const timestamp = parseInt(start, 10);
|
||||
if (isNaN(timestamp)) return 'Invalid date';
|
||||
|
||||
const date = new Date(timestamp * 1000);
|
||||
const options: Intl.DateTimeFormatOptions = {
|
||||
weekday: 'short',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: '2-digit',
|
||||
timeZoneName: 'short',
|
||||
};
|
||||
if (startTzid) {
|
||||
options.timeZone = startTzid;
|
||||
}
|
||||
return date.toLocaleString(undefined, options);
|
||||
}
|
||||
|
||||
if (kind === 31922) {
|
||||
// Date-based event - start is YYYY-MM-DD
|
||||
const date = new Date(start + 'T00:00:00');
|
||||
return date.toLocaleDateString(undefined, {
|
||||
weekday: 'long',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
});
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
@@ -75,6 +75,7 @@ describe('useGenerateProjectInfo', () => {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: '',
|
||||
};
|
||||
mockUseAppContext.mockReturnValue({
|
||||
config,
|
||||
@@ -228,6 +229,7 @@ describe('useGenerateProjectInfo', () => {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: '',
|
||||
};
|
||||
mockUseAppContext.mockReturnValue({
|
||||
config,
|
||||
|
||||
@@ -52,6 +52,7 @@ function createWrapper(corsProxy: string) {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: 'naddr1qvzqqqr4xgpzpjcswsacvumftxsmcejj3vsxu8mf203p8hkxoklxtgva7rdxzm0qqy88wumn8ghj7mn0wd68yttsw43z7qg4waehxw309aex2mrp0yhx6mmddaehgu339e3k7mf0qythwumn8ghj7cn5vvhxkmr9dejxz7n0xvs8xmmrdejhytnrdakj7q3qdqr8kgh3s5q8ztw0swmvpwz98cse7rw43n4nhrpszgafnuwrxh8hscmhv5m',
|
||||
};
|
||||
|
||||
return createElement(
|
||||
|
||||
@@ -56,6 +56,7 @@ const testConfig: AppConfig = {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: 'naddr1qvzqqqr4xgpzpjcswsacvumftxsmcejj3vsxu8mf203p8hkxoklxtgva7rdxzm0qqy88wumn8ghj7mn0wd68yttsw43z7qg4waehxw309aex2mrp0yhx6mmddaehgu339e3k7mf0qythwumn8ghj7cn5vvhxkmr9dejxz7n0xvs8xmmrdejhytnrdakj7q3qdqr8kgh3s5q8ztw0swmvpwz98cse7rw43n4nhrpszgafnuwrxh8hscmhv5m',
|
||||
};
|
||||
|
||||
describe('SessionManager', () => {
|
||||
|
||||
@@ -43,6 +43,7 @@ const testConfig: AppConfig = {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: 'naddr1qvzqqqr4xgpzpjcswsacvumftxsmcejj3vsxu8mf203p8hkxoklxtgva7rdxzm0qqy88wumn8ghj7mn0wd68yttsw43z7qg4waehxw309aex2mrp0yhx6mmddaehgu339e3k7mf0qythwumn8ghj7cn5vvhxkmr9dejxz7n0xvs8xmmrdejhytnrdakj7q3qdqr8kgh3s5q8ztw0swmvpwz98cse7rw43n4nhrpszgafnuwrxh8hscmhv5m',
|
||||
};
|
||||
|
||||
describe('makeSystemPrompt', () => {
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "Display the app showcase section on the home page",
|
||||
"showcaseModerator": "Showcase Moderator",
|
||||
"showcaseModeratorDescription": "Nostr public key (npub) of the user who can moderate showcase submissions",
|
||||
"communityFollowPack": "Community",
|
||||
"communityFollowPackDescription": "Nostr event of the follow pack used for the Community Events section of the Community page",
|
||||
"filesystemPaths": "Filesystem Paths",
|
||||
"projectsDirectory": "Projects Directory",
|
||||
"projectsDirectoryDescription": "Filesystem path where projects are stored",
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "Nuna sashen nuni na aikace-aikace a shafin gida",
|
||||
"showcaseModerator": "Mai Kula da Nuni",
|
||||
"showcaseModeratorDescription": "Maɓallin jama'a na Nostr (npub) na mai amfani wanda zai iya kula da ƙaddamarwar nuni",
|
||||
"communityFollowPack": "Al'umma",
|
||||
"communityFollowPackDescription": "Taron Nostr na fakitin bi da ake amfani da shi don sashen Ayyukan Al'umma a shafin Al'umma",
|
||||
"filesystemPaths": "Hanyoyin Tsarin Fayil",
|
||||
"projectsDirectory": "Kundin Ayyuka",
|
||||
"projectsDirectoryDescription": "Hanyar tsarin fayil inda ake adana ayyuka",
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "Gosipụta ngalaba ngosipụta ngwa na ibe ụlọ",
|
||||
"showcaseModerator": "Onye Nlekọta Ngosipụta",
|
||||
"showcaseModeratorDescription": "Igodo ọha Nostr (npub) nke onye ọrụ nwere ike ilekọta ntinye ngosipụta",
|
||||
"communityFollowPack": "Obodo",
|
||||
"communityFollowPackDescription": "Ihe omume Nostr nke ngwugwu eso a na-eji maka ngalaba Mmemme Obodo na ibe Obodo",
|
||||
"filesystemPaths": "Ụzọ Sistemu Faịlụ",
|
||||
"projectsDirectory": "Ndekọ Ọrụ",
|
||||
"projectsDirectoryDescription": "Ụzọ sistemu faịlụ ebe echekwara ọrụ",
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "Exibir a seção de vitrine de aplicativos na página inicial",
|
||||
"showcaseModerator": "Moderador da Vitrine",
|
||||
"showcaseModeratorDescription": "Chave pública Nostr (npub) do usuário que pode moderar envios da vitrine",
|
||||
"communityFollowPack": "Comunidade",
|
||||
"communityFollowPackDescription": "Evento Nostr do pacote de seguir usado para a seção de Eventos da Comunidade na página da Comunidade",
|
||||
"filesystemPaths": "Caminhos do Sistema de Arquivos",
|
||||
"projectsDirectory": "Diretório de Projetos",
|
||||
"projectsDirectoryDescription": "Caminho do sistema de arquivos onde os projetos são armazenados",
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "Ṣafihan apakan ifihan ohun elo lori oju-iwe ile",
|
||||
"showcaseModerator": "Oluṣakoso Ifihan",
|
||||
"showcaseModeratorDescription": "Bọtini gbangba Nostr (npub) ti olumulo ti o le ṣakoso awọn ifisilẹ ifihan",
|
||||
"communityFollowPack": "Agbegbe",
|
||||
"communityFollowPackDescription": "Iṣẹlẹ Nostr ti apo atẹle ti a lo fun apakan Awọn Iṣẹlẹ Agbegbe lori oju-iwe Agbegbe",
|
||||
"filesystemPaths": "Awọn Ọna Eto Faili",
|
||||
"projectsDirectory": "Itọsọna Awọn iṣẹ akanṣe",
|
||||
"projectsDirectoryDescription": "Ọna eto faili nibiti a tọju awọn iṣẹ akanṣe",
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
"showcaseEnabledDescription": "在主页上显示应用展示部分",
|
||||
"showcaseModerator": "展示管理员",
|
||||
"showcaseModeratorDescription": "可以审核展示提交的用户的Nostr公钥(npub)",
|
||||
"communityFollowPack": "社区",
|
||||
"communityFollowPackDescription": "用于社区页面社区活动部分的关注包的Nostr事件",
|
||||
"filesystemPaths": "文件系统路径",
|
||||
"projectsDirectory": "项目目录",
|
||||
"projectsDirectoryDescription": "存储项目的文件系统路径",
|
||||
|
||||
@@ -0,0 +1,748 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import { useSeoMeta } from '@unhead/react';
|
||||
import {
|
||||
ArrowLeft,
|
||||
ExternalLink,
|
||||
MessageCircle,
|
||||
Calendar,
|
||||
Award,
|
||||
MapPin,
|
||||
Video,
|
||||
BookOpen,
|
||||
Sparkles,
|
||||
ArrowRight,
|
||||
HelpCircle,
|
||||
Megaphone,
|
||||
MessageSquare,
|
||||
GitBranch,
|
||||
Lightbulb,
|
||||
Image,
|
||||
LifeBuoy,
|
||||
Hash,
|
||||
} from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
import { NoteContent } from '@/components/NoteContent';
|
||||
import { ShakespeareLogo } from '@/components/ShakespeareLogo';
|
||||
import { useAuthor } from '@/hooks/useAuthor';
|
||||
import {
|
||||
useShakespeareFeed,
|
||||
useCommunityEvents,
|
||||
extractCalendarEventData,
|
||||
formatEventDate,
|
||||
} from '@/hooks/useCommunity';
|
||||
import type { NostrEvent } from '@nostrify/nostrify';
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import { genUserName } from '@/lib/genUserName';
|
||||
|
||||
// Stock images for cards (to be replaced later)
|
||||
const STOCK_IMAGES = {
|
||||
chat: 'https://images.unsplash.com/photo-1522071820081-009f0129c71c?w=800&q=80',
|
||||
events: 'https://soapbox.pub/assets/blog/shakespeare-workshop-guide/derek-shakespeare-workshop.jpeg',
|
||||
ambassador: 'https://images.unsplash.com/photo-1517486808906-6ca8b3f04846?w=800&q=80',
|
||||
workshop: 'https://soapbox.pub/assets/press/satsconf-brazil-2025/alex-workshop.jpeg',
|
||||
};
|
||||
|
||||
// FAQs from soapbox.pub/shakespeare-resources
|
||||
const FAQS = [
|
||||
{
|
||||
question: 'What is Shakespeare and how does it work?',
|
||||
answer:
|
||||
'Shakespeare is an AI-powered website builder that lets you create custom websites by chatting with AI. Simply describe what you want to build, and AI will code, design, and deploy your site for you.',
|
||||
},
|
||||
{
|
||||
question: 'Do I need coding experience to use Shakespeare?',
|
||||
answer:
|
||||
'No coding experience required! Shakespeare is designed for everyone. Just describe your ideas in plain language and let the AI handle the technical details.',
|
||||
},
|
||||
{
|
||||
question: 'How much does Shakespeare cost?',
|
||||
answer:
|
||||
'Shakespeare uses a pay-as-you-go credit system through NSPs (Nostr Service Providers). You only pay for what you use, with no monthly subscriptions required.',
|
||||
},
|
||||
{
|
||||
question: 'Can I download my website\'s source code?',
|
||||
answer:
|
||||
'Yes! You can download your complete project source code at any time. You own everything you create.',
|
||||
},
|
||||
{
|
||||
question: 'Where can I get help if I\'m stuck?',
|
||||
answer:
|
||||
'Join Shakespeare Chat at chat.shakespeare.diy to connect with other builders, get help from the community, and share what you\'re building!',
|
||||
},
|
||||
];
|
||||
|
||||
// Featured blog posts
|
||||
const BLOG_POSTS = [
|
||||
{
|
||||
title: 'How to Prompt Better Projects',
|
||||
url: 'https://soapbox.pub/blog/how-to-prompt-better-projects',
|
||||
author: 'Derek Ross',
|
||||
},
|
||||
{
|
||||
title: 'Deploying your Shakespeare project',
|
||||
url: 'https://soapbox.pub/blog/shakespeare-deploying-sharing-projects',
|
||||
author: 'M.K. Fain',
|
||||
},
|
||||
{
|
||||
title: 'Debugging in Shakespeare',
|
||||
url: 'https://soapbox.pub/blog/debugging-in-shakespeare',
|
||||
author: 'Derek Ross',
|
||||
},
|
||||
];
|
||||
|
||||
export default function Community() {
|
||||
useSeoMeta({
|
||||
title: 'Community - Shakespeare',
|
||||
description: 'Join the Shakespeare community. Connect with builders, attend events, and get help with your projects.',
|
||||
});
|
||||
|
||||
const { data: feedPosts, isLoading: feedLoading } = useShakespeareFeed(6);
|
||||
const { data: events, isLoading: eventsLoading } = useCommunityEvents(4);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-background via-background to-primary/5">
|
||||
{/* Topbar */}
|
||||
<div className="border-b border-border bg-gradient-to-r from-primary/10 via-accent/5 to-primary/10">
|
||||
<div className="container mx-auto px-4 py-3 max-w-5xl">
|
||||
<div className="flex items-center justify-between">
|
||||
<Link to="/" className="flex items-center gap-3 hover:opacity-80 transition-opacity">
|
||||
<ShakespeareLogo className="w-6 h-6" />
|
||||
<h1 className="text-xl font-semibold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
Shakespeare
|
||||
</h1>
|
||||
</Link>
|
||||
<Link to="/">
|
||||
<Button variant="ghost" size="sm">
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Projects
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="container mx-auto px-4 py-8 max-w-5xl">
|
||||
<div className="space-y-12">
|
||||
{/* Hero Section */}
|
||||
<section className="text-center space-y-4">
|
||||
<h1 className="text-4xl md:text-5xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent">
|
||||
Welcome to the Shakespeare Community
|
||||
</h1>
|
||||
<p className="text-lg text-muted-foreground max-w-2xl mx-auto">
|
||||
Connect with builders, get help with your projects, and be part of the future of AI-powered web development.
|
||||
</p>
|
||||
<div className="flex flex-wrap justify-center gap-3 pt-4">
|
||||
<Button asChild size="lg" className="bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90">
|
||||
<a href="https://app.flotilla.social/join?r=chat.shakespeare.diy&c=725J9PH4" target="_blank" rel="noopener noreferrer">
|
||||
<MessageCircle className="h-4 w-4 mr-2" />
|
||||
Join Shakespeare Chat
|
||||
</a>
|
||||
</Button>
|
||||
<Button asChild variant="outline" size="lg">
|
||||
<a href="#events">
|
||||
<Calendar className="h-4 w-4 mr-2" />
|
||||
Browse Events
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* How to Get Involved - 3 Cards */}
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-2xl font-bold text-center">How to Get Involved</h2>
|
||||
<div className="grid md:grid-cols-3 gap-6">
|
||||
{/* Join Community Online */}
|
||||
<Card className="overflow-hidden group hover:shadow-lg transition-shadow flex flex-col">
|
||||
<div className="aspect-[4/3] overflow-hidden">
|
||||
<img
|
||||
src={STOCK_IMAGES.chat}
|
||||
alt="Community chat"
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="flex-1">
|
||||
<div className="w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center mb-2">
|
||||
<MessageCircle className="h-5 w-5 text-primary" />
|
||||
</div>
|
||||
<CardTitle>Join Community Online</CardTitle>
|
||||
<CardDescription>
|
||||
Chat with other Shakespeare builders, get help with your projects, and share what you're creating.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="mt-auto">
|
||||
<Button asChild variant="outline" className="w-full">
|
||||
<a href="https://app.flotilla.social/join?r=chat.shakespeare.diy&c=725J9PH4" target="_blank" rel="noopener noreferrer">
|
||||
Join Shakespeare Chat
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Connect IRL */}
|
||||
<Card className="overflow-hidden group hover:shadow-lg transition-shadow flex flex-col">
|
||||
<div className="aspect-[4/3] overflow-hidden">
|
||||
<img
|
||||
src={STOCK_IMAGES.events}
|
||||
alt="Community events"
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="flex-1">
|
||||
<div className="w-10 h-10 rounded-lg bg-accent/10 flex items-center justify-center mb-2">
|
||||
<Calendar className="h-5 w-5 text-accent" />
|
||||
</div>
|
||||
<CardTitle>Connect IRL</CardTitle>
|
||||
<CardDescription>
|
||||
Attend conferences, workshops, and meetups. Learn from experts and network with fellow builders.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="mt-auto">
|
||||
<Button asChild variant="outline" className="w-full">
|
||||
<a href="#events">
|
||||
View Events
|
||||
<ArrowRight className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Become an Ambassador */}
|
||||
<Card className="overflow-hidden group hover:shadow-lg transition-shadow flex flex-col">
|
||||
<div className="aspect-[4/3] overflow-hidden">
|
||||
<img
|
||||
src={STOCK_IMAGES.ambassador}
|
||||
alt="Ambassador program"
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"
|
||||
style={{ objectPosition: '50% 60%' }}
|
||||
/>
|
||||
</div>
|
||||
<CardHeader className="flex-1">
|
||||
<div className="w-10 h-10 rounded-lg bg-yellow-500/10 flex items-center justify-center mb-2">
|
||||
<Award className="h-5 w-5 text-yellow-600" />
|
||||
</div>
|
||||
<CardTitle>Become an Ambassador</CardTitle>
|
||||
<CardDescription>
|
||||
Host workshops in your city, teach others to build with Shakespeare, and earn recognition.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="mt-auto">
|
||||
<Button asChild variant="outline" className="w-full">
|
||||
<a href="#ambassador">
|
||||
Learn More
|
||||
<ArrowRight className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* #ShakespeareDIY Feed */}
|
||||
<section className="space-y-6">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold flex items-center gap-2">
|
||||
<Sparkles className="h-6 w-6 text-primary" />
|
||||
#ShakespeareDIY Feed
|
||||
</h2>
|
||||
<p className="text-muted-foreground">See what the community is building</p>
|
||||
</div>
|
||||
<Badge variant="outline" className="w-fit">Live from Nostr</Badge>
|
||||
</div>
|
||||
|
||||
{feedLoading ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{Array.from({ length: 4 }).map((_, i) => (
|
||||
<Card key={i}>
|
||||
<CardContent className="pt-4">
|
||||
<div className="flex items-start gap-3">
|
||||
<Skeleton className="h-10 w-10 rounded-full flex-shrink-0" />
|
||||
<div className="flex-1 min-w-0 space-y-2">
|
||||
<Skeleton className="h-4 w-24" />
|
||||
<Skeleton className="h-16 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : feedPosts && feedPosts.length > 0 ? (
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 auto-rows-fr">
|
||||
{feedPosts.map((post) => (
|
||||
<FeedPost key={post.id} event={post} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 text-center">
|
||||
<p className="text-muted-foreground">
|
||||
No posts yet. Be the first to share with #ShakespeareDIY!
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* Events Section */}
|
||||
<section id="events" className="space-y-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold flex items-center gap-2">
|
||||
<Calendar className="h-6 w-6 text-accent" />
|
||||
Upcoming Events
|
||||
</h2>
|
||||
<p className="text-muted-foreground">Conferences, workshops, and meetups</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{eventsLoading ? (
|
||||
<div className="grid md:grid-cols-2 gap-4">
|
||||
{Array.from({ length: 2 }).map((_, i) => (
|
||||
<Card key={i}>
|
||||
<CardContent className="pt-4">
|
||||
<Skeleton className="h-32 w-full rounded-lg mb-4" />
|
||||
<Skeleton className="h-6 w-48 mb-2" />
|
||||
<Skeleton className="h-4 w-32" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : events && events.length > 0 ? (
|
||||
<div className="grid md:grid-cols-2 gap-4">
|
||||
{events.map((event) => (
|
||||
<EventCard key={event.id} event={event} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<Card className="border-dashed">
|
||||
<CardContent className="py-12 text-center">
|
||||
<Calendar className="h-12 w-12 mx-auto mb-4 text-muted-foreground/50" />
|
||||
<p className="text-muted-foreground">
|
||||
No upcoming events. Check back soon!
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{/* Ambassador Program */}
|
||||
<section id="ambassador" className="space-y-6">
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
<Card className="bg-gradient-to-br from-primary/5 to-accent/5 border-primary/20">
|
||||
<CardHeader>
|
||||
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-accent flex items-center justify-center mb-4">
|
||||
<Award className="h-6 w-6 text-white" />
|
||||
</div>
|
||||
<CardTitle className="text-xl">Shakespeare Ambassador Program</CardTitle>
|
||||
<CardDescription>
|
||||
Become a community leader by hosting workshops in your city. Teach others how to build with Shakespeare
|
||||
and help grow the community.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<ul className="space-y-2 text-sm">
|
||||
<li className="flex items-center gap-2">
|
||||
<div className="h-1.5 w-1.5 rounded-full bg-primary" />
|
||||
Host local workshops and meetups
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<div className="h-1.5 w-1.5 rounded-full bg-primary" />
|
||||
Get exclusive access to new features
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<div className="h-1.5 w-1.5 rounded-full bg-primary" />
|
||||
Earn free credits for teaching
|
||||
</li>
|
||||
<li className="flex items-center gap-2">
|
||||
<div className="h-1.5 w-1.5 rounded-full bg-primary" />
|
||||
Be recognized in the community
|
||||
</li>
|
||||
</ul>
|
||||
<Button asChild className="w-full">
|
||||
<a href="https://app.flotilla.social/join?r=chat.shakespeare.diy&c=725J9PH4" target="_blank" rel="noopener noreferrer">
|
||||
Apply to Become an Ambassador
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="overflow-hidden">
|
||||
<div className="aspect-video overflow-hidden">
|
||||
<img
|
||||
src={STOCK_IMAGES.workshop}
|
||||
alt="Workshop"
|
||||
className="w-full h-full object-cover"
|
||||
style={{ objectPosition: '50% 10%' }}
|
||||
/>
|
||||
</div>
|
||||
<CardHeader>
|
||||
<CardTitle>Host a Workshop</CardTitle>
|
||||
<CardDescription>
|
||||
Already know Shakespeare well? Host a workshop in your area and teach others how to build amazing
|
||||
websites with AI.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Button asChild variant="outline" className="w-full">
|
||||
<a href="https://soapbox.pub/blog/shakespeare-workshop-guide" target="_blank" rel="noopener noreferrer">
|
||||
View Workshop Guide
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Chat Channels */}
|
||||
<section className="space-y-6">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold flex items-center gap-2">
|
||||
<Hash className="h-6 w-6 text-primary" />
|
||||
Chat Channels
|
||||
</h2>
|
||||
<p className="text-muted-foreground">Explore the different channels in Shakespeare Chat</p>
|
||||
</div>
|
||||
|
||||
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-blue-500/10 flex items-center justify-center">
|
||||
<Megaphone className="h-4 w-4 text-blue-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#announcements</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Official updates about Shakespeare features, releases, and important news from the team.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-purple-500/10 flex items-center justify-center">
|
||||
<MessageSquare className="h-4 w-4 text-purple-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#feedback</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Share your ideas, suggestions, and feedback to help improve Shakespeare.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-green-500/10 flex items-center justify-center">
|
||||
<GitBranch className="h-4 w-4 text-green-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#git</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Follow along with the latest commits and development activity on Shakespeare.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-yellow-500/10 flex items-center justify-center">
|
||||
<Lightbulb className="h-4 w-4 text-yellow-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#prompts</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Share and discover effective prompts for building better projects with AI.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-pink-500/10 flex items-center justify-center">
|
||||
<Image className="h-4 w-4 text-pink-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#showcase</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Show off your Shakespeare creations and get inspired by what others have built.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="pb-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-lg bg-red-500/10 flex items-center justify-center">
|
||||
<LifeBuoy className="h-4 w-4 text-red-500" />
|
||||
</div>
|
||||
<CardTitle className="text-base">#support</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Get help from the community when you're stuck or have questions about using Shakespeare.
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className="text-center">
|
||||
<Button asChild>
|
||||
<a href="https://app.flotilla.social/join?r=chat.shakespeare.diy&c=725J9PH4" target="_blank" rel="noopener noreferrer">
|
||||
<MessageCircle className="h-4 w-4 mr-2" />
|
||||
Join Shakespeare Chat
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Resources Section */}
|
||||
<section className="space-y-6">
|
||||
<h2 className="text-2xl font-bold flex items-center gap-2">
|
||||
<BookOpen className="h-6 w-6 text-blue-600" />
|
||||
Resources
|
||||
</h2>
|
||||
<div className="grid md:grid-cols-2 gap-6">
|
||||
{/* Blog Posts */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Featured Guides</CardTitle>
|
||||
<CardDescription>Learn tips and tricks from the community</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
{BLOG_POSTS.map((post, i) => (
|
||||
<a
|
||||
key={i}
|
||||
href={post.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center justify-between p-3 rounded-lg hover:bg-muted transition-colors group"
|
||||
>
|
||||
<div>
|
||||
<p className="font-medium group-hover:text-primary transition-colors">
|
||||
{post.title}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">by {post.author}</p>
|
||||
</div>
|
||||
<ExternalLink className="h-4 w-4 text-muted-foreground group-hover:text-primary" />
|
||||
</a>
|
||||
))}
|
||||
<Button asChild variant="ghost" className="w-full mt-2">
|
||||
<a
|
||||
href="https://soapbox.pub/shakespeare-resources/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
View All Resources
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* FAQs */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<HelpCircle className="h-5 w-5" />
|
||||
Frequently Asked Questions
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
{FAQS.map((faq, i) => (
|
||||
<AccordionItem key={i} value={`faq-${i}`}>
|
||||
<AccordionTrigger className="text-left text-sm px-3">
|
||||
{faq.question}
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="text-muted-foreground text-sm px-3">
|
||||
{faq.answer}
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
))}
|
||||
</Accordion>
|
||||
<Button asChild variant="ghost" className="w-full mt-4">
|
||||
<a
|
||||
href="https://soapbox.pub/shakespeare-resources/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
View All FAQs
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Final CTA */}
|
||||
<section className="text-center space-y-4 py-8">
|
||||
<h2 className="text-2xl font-bold">Ready to Join?</h2>
|
||||
<p className="text-muted-foreground max-w-xl mx-auto">
|
||||
Join Shakespeare Chat to connect with the community, get help with your projects, and be part of the
|
||||
conversation.
|
||||
</p>
|
||||
<Button asChild size="lg" className="bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90">
|
||||
<a href="https://app.flotilla.social/join?r=chat.shakespeare.diy&c=725J9PH4" target="_blank" rel="noopener noreferrer">
|
||||
<MessageCircle className="h-4 w-4 mr-2" />
|
||||
Join Shakespeare Chat
|
||||
<ExternalLink className="h-4 w-4 ml-2" />
|
||||
</a>
|
||||
</Button>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Feed Post Component
|
||||
function FeedPost({ event }: { event: NostrEvent }) {
|
||||
const { data: author } = useAuthor(event.pubkey);
|
||||
const displayName = author?.metadata?.name || genUserName(event.pubkey);
|
||||
const picture = author?.metadata?.picture;
|
||||
const timeAgo = getTimeAgo(event.created_at);
|
||||
const nevent = nip19.neventEncode({ id: event.id, author: event.pubkey });
|
||||
const njumpUrl = `https://njump.me/${nevent}`;
|
||||
|
||||
return (
|
||||
<a href={njumpUrl} target="_blank" rel="noopener noreferrer" className="block h-full">
|
||||
<Card className="hover:shadow-md transition-shadow cursor-pointer h-full">
|
||||
<CardContent className="pt-4 h-full">
|
||||
<div className="flex items-start gap-3 h-full">
|
||||
<Avatar className="h-10 w-10 flex-shrink-0">
|
||||
<AvatarImage src={picture} alt={displayName} />
|
||||
<AvatarFallback>{displayName.slice(0, 2).toUpperCase()}</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-2 mb-1">
|
||||
<span className="font-medium text-sm truncate">{displayName}</span>
|
||||
<span className="text-xs text-muted-foreground">{timeAgo}</span>
|
||||
</div>
|
||||
<div className="text-sm">
|
||||
<NoteContent event={event} className="line-clamp-4" disableLinks hideEmbeds />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
// Helper to check if a string is a URL
|
||||
function isUrl(str: string): boolean {
|
||||
try {
|
||||
const url = new URL(str);
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Event Card Component
|
||||
function EventCard({ event }: { event: NostrEvent }) {
|
||||
const eventData = extractCalendarEventData(event);
|
||||
const formattedDate = formatEventDate(eventData.start, eventData.kind, eventData.startTzid);
|
||||
const isVirtual = eventData.location && isUrl(eventData.location);
|
||||
|
||||
return (
|
||||
<Card className="hover:shadow-md transition-shadow overflow-hidden">
|
||||
{eventData.image && (
|
||||
<div className="aspect-video overflow-hidden">
|
||||
<img
|
||||
src={eventData.image}
|
||||
alt={eventData.title}
|
||||
className="w-full h-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<CardHeader>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<div>
|
||||
<CardTitle className="text-lg">{eventData.title}</CardTitle>
|
||||
{eventData.summary && (
|
||||
<CardDescription className="mt-1">{eventData.summary}</CardDescription>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-2">
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<Calendar className="h-4 w-4" />
|
||||
<span>{formattedDate}</span>
|
||||
</div>
|
||||
{eventData.location && (
|
||||
isVirtual ? (
|
||||
<a
|
||||
href={eventData.location}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-2 text-sm text-primary hover:underline"
|
||||
>
|
||||
<Video className="h-4 w-4" />
|
||||
<span>Virtual</span>
|
||||
<ExternalLink className="h-3 w-3" />
|
||||
</a>
|
||||
) : (
|
||||
<div className="flex items-center gap-2 text-sm text-muted-foreground">
|
||||
<MapPin className="h-4 w-4" />
|
||||
<span>{eventData.location}</span>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
{eventData.hashtags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-1 pt-2">
|
||||
{eventData.hashtags.slice(0, 3).map((tag, i) => (
|
||||
<Badge key={i} variant="secondary" className="text-xs">
|
||||
#{tag}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
// Helper function
|
||||
function getTimeAgo(timestamp: number): string {
|
||||
const seconds = Math.floor(Date.now() / 1000 - timestamp);
|
||||
if (seconds < 60) return 'just now';
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
if (minutes < 60) return `${minutes}m`;
|
||||
const hours = Math.floor(minutes / 60);
|
||||
if (hours < 24) return `${hours}h`;
|
||||
const days = Math.floor(hours / 24);
|
||||
if (days < 7) return `${days}d`;
|
||||
const weeks = Math.floor(days / 7);
|
||||
if (weeks < 4) return `${weeks}w`;
|
||||
const months = Math.floor(days / 30);
|
||||
if (months < 12) return `${months}mo`;
|
||||
return `${Math.floor(months / 12)}y`;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Settings, ArrowLeft, RefreshCw, Trash2, XCircle, Loader2, RotateCcw, Cog, Globe, Image, Code, Monitor, Award, Bug, FolderTree, Terminal as TerminalIcon } from "lucide-react";
|
||||
import { Settings, ArrowLeft, RefreshCw, Trash2, XCircle, Loader2, RotateCcw, Cog, Globe, Image, Code, Monitor, Award, Bug, FolderTree, Terminal as TerminalIcon, Users } from "lucide-react";
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -26,6 +26,7 @@ export function SystemSettings() {
|
||||
const [faviconUrlInput, setFaviconUrlInput] = useState(config.faviconUrl);
|
||||
const [previewDomainInput, setPreviewDomainInput] = useState(config.previewDomain);
|
||||
const [showcaseModeratorInput, setShowcaseModeratorInput] = useState(config.showcaseModerator);
|
||||
const [communityFollowPackInput, setCommunityFollowPackInput] = useState(config.communityFollowPack);
|
||||
const [fsPathProjectsInput, setFsPathProjectsInput] = useState(config.fsPathProjects);
|
||||
const [fsPathConfigInput, setFsPathConfigInput] = useState(config.fsPathConfig);
|
||||
const [fsPathTmpInput, setFsPathTmpInput] = useState(config.fsPathTmp);
|
||||
@@ -41,6 +42,7 @@ export function SystemSettings() {
|
||||
previewDomain: config.previewDomain !== defaultConfig.previewDomain,
|
||||
showcaseEnabled: config.showcaseEnabled !== defaultConfig.showcaseEnabled,
|
||||
showcaseModerator: config.showcaseModerator !== defaultConfig.showcaseModerator,
|
||||
communityFollowPack: config.communityFollowPack !== defaultConfig.communityFollowPack,
|
||||
fsPathProjects: config.fsPathProjects !== defaultConfig.fsPathProjects,
|
||||
fsPathConfig: config.fsPathConfig !== defaultConfig.fsPathConfig,
|
||||
fsPathTmp: config.fsPathTmp !== defaultConfig.fsPathTmp,
|
||||
@@ -102,6 +104,15 @@ export function SystemSettings() {
|
||||
});
|
||||
};
|
||||
|
||||
const restoreCommunityFollowPack = () => {
|
||||
const defaultValue = defaultConfig.communityFollowPack;
|
||||
setCommunityFollowPackInput(defaultValue);
|
||||
updateConfig((current) => {
|
||||
const { communityFollowPack, ...rest } = current;
|
||||
return rest;
|
||||
});
|
||||
};
|
||||
|
||||
const restoreFsPathProjects = () => {
|
||||
const defaultValue = defaultConfig.fsPathProjects;
|
||||
setFsPathProjectsInput(defaultValue);
|
||||
@@ -680,6 +691,55 @@ export function SystemSettings() {
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
||||
{/* Community Follow Pack Configuration */}
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="community-follow-pack">
|
||||
<AccordionTrigger className="px-4 py-3 hover:no-underline">
|
||||
<div className="flex items-center gap-2">
|
||||
<Users className="h-4 w-4 text-muted-foreground" />
|
||||
<h4 className="text-sm font-medium">{t('communityFollowPack')}</h4>
|
||||
{isModified.communityFollowPack && (
|
||||
<div className="h-2 w-2 rounded-full bg-yellow-500" title={t('modified')} />
|
||||
)}
|
||||
</div>
|
||||
</AccordionTrigger>
|
||||
<AccordionContent className="px-4 pb-4">
|
||||
<div className="py-1 space-y-2">
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
id="community-follow-pack"
|
||||
type="text"
|
||||
placeholder="naddr1..."
|
||||
value={communityFollowPackInput}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
setCommunityFollowPackInput(value);
|
||||
updateConfig((current) => ({
|
||||
...current,
|
||||
communityFollowPack: value,
|
||||
}));
|
||||
}}
|
||||
className="flex-1"
|
||||
/>
|
||||
{isModified.communityFollowPack && (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={restoreCommunityFollowPack}
|
||||
title={t('restoreToDefault')}
|
||||
>
|
||||
<RotateCcw className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('communityFollowPackDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</AccordionContent>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
|
||||
{/* Sentry DSN Configuration */}
|
||||
<Accordion type="single" collapsible className="w-full">
|
||||
<AccordionItem value="sentry-dsn">
|
||||
|
||||
@@ -57,6 +57,7 @@ export function TestApp({ children }: TestAppProps) {
|
||||
fsPathTemplates: '/templates',
|
||||
sentryDsn: '',
|
||||
sentryEnabled: false,
|
||||
communityFollowPack: 'naddr1qvzqqqr4xgpzpjcswsacvumftxsmcejj3vsxu8mf203p8hkxoklxtgva7rdxzm0qqy88wumn8ghj7mn0wd68yttsw43z7qg4waehxw309aex2mrp0yhx6mmddaehgu339e3k7mf0qythwumn8ghj7cn5vvhxkmr9dejxz7n0xvs8xmmrdejhytnrdakj7q3qdqr8kgh3s5q8ztw0swmvpwz98cse7rw43n4nhrpszgafnuwrxh8hscmhv5m',
|
||||
};
|
||||
|
||||
// Initialize LightningFS for testing
|
||||
|
||||
Reference in new issue
Block a user