);
}
export function WelcomeScreen(
{
hasLocations,
locationCount,
documentCount,
onCreateNewDocument,
onOpenExisting,
onAddLocation,
onOpenImportSheet,
onOpenStandardSiteImportSheet,
}: WelcomeScreenProps,
) {
const meta = useMemo(
() => ({
headline: hasLocations ? "Welcome" : "Start by adding a location.",
description: hasLocations
? "Create a fresh draft, reopen something from your library, or pull material in from an external source."
: "Commonplace needs a location before it can create drafts, save notes, or import anything into your workspace.",
locationSummary: hasLocations
? `${formatCount(locationCount, "location", "locations")} connected`
: "No locations connected",
documentSummary: hasLocations
? `${formatCount(documentCount, "document", "documents")}`
: "Import available after connecting a location",
}),
[hasLocations, locationCount, documentCount],
);
const actions = useMemo(
() => [{
title: "Create new",
description: hasLocations
? "Open a blank draft in the selected location."
: "Add a location first so the draft has somewhere to live.",
icon: "create",
onClick: onCreateNewDocument,
disabled: !hasLocations || !onCreateNewDocument,
iconClassName: "text-accent-blue",
iconContainerClassName: "bg-layer-03",
}, {
title: "Open existing",
description: hasLocations
? "Search your library and jump straight into an existing document."
: "Connect a location first to browse or search stored work.",
icon: "search",
onClick: onOpenExisting,
disabled: !hasLocations,
iconClassName: "text-text-primary",
iconContainerClassName: "bg-layer-03",
}, {
title: "Import from Tangled",
description: "Pull in strings from Tangled and save them as local documents.",
icon: "tangled",
onClick: onOpenImportSheet,
disabled: !hasLocations || !onOpenImportSheet,
iconClassName: "text-accent-magenta",
iconContainerClassName: "bg-layer-03",
}, {
title: "Import Standard.Site Documents",
description: "Bring public posts into Commonplace for local editing and revision.",
icon: "standardSite",
onClick: onOpenStandardSiteImportSheet,
disabled: !hasLocations || !onOpenStandardSiteImportSheet,
iconClassName: "text-accent-green",
iconContainerClassName: "bg-layer-03",
}],
[hasLocations, onCreateNewDocument, onOpenExisting, onOpenImportSheet, onOpenStandardSiteImportSheet],
);
return (