(null)
-
- // focus input on first render
- useEffect(() => {
- if (hostRef.current) {
- hostRef.current.focus()
- }
- }, [])
- return (
- <>
-
- onDone(null)} />
- Add Mintter Web Site
-
- {addSite.error ? (
- //@ts-ignore
- {addSite.error?.message}
- ) : null}
- {addSite.isLoading ? : null}
- Follow the self-hosting guide and copy the invite URL:
-
-
-
-
- >
- )
-}
-
-const NewSitePage = Symbol('NewSitePage')
-function SitesSettings({}: {}) {
- const daemonInfo = useDaemonInfo()
- const accountId = daemonInfo.data?.accountId
- const [activeSitePage, setActiveSitePage] = useState<
- string | typeof NewSitePage | null
- >(null)
- if (!accountId) return null
- if (activeSitePage === NewSitePage) {
- return setActiveSitePage(s)} />
- }
- if (typeof activeSitePage == 'string') {
- return (
- setActiveSitePage(null)}
- />
- )
- }
- return (
-
-
- Sites
-
-
-
- setActiveSitePage(siteId)} />
-
- )
-}
-
-function EmptySiteList() {
- return (
-
- no sites yet
-
- )
-}
-
-function SiteItem({site, onSelect}: {site: SiteConfig; onSelect: () => void}) {
- return (
-
-
- {hostnameStripProtocol(site.hostname)}
-
-
- )
-}
-
-function SitesList({onSelectSite}: {onSelectSite: (siteId: string) => void}) {
- const {data: sites, isLoading} = useSiteList()
- return (
-
- {isLoading && }
- {sites && sites.length === 0 && }
- {sites?.map((site) => (
- {
- onSelectSite(site.hostname)
- }}
- />
- ))}
-
- )
-}
-
const TabsContent = (props: TabsContentProps) => {
return (
{
- // sort path === '/' to the top
- // sort path === '' to the bottom
- return data?.publications.sort((a, b) => {
- if (a.path === '/') return -1
- if (b.path === '/') return 1
- if (a.path === '') return 1
- if (b.path === '') return -1
- return 0
- })
- }, [data])
- const openDraft = useOpenDraft('push')
- if (!host) throw new Error('Hostname not found for SitePage')
-
- return (
- <>
-
-
- {isLoading && }
- {sortedPubs ? (
-
- {sortedPubs.map((publication) => (
-
- ))}
-
- ) : null}
- {!sortedPubs && !isLoading ? (
- {
- openDraft()
- }}
- />
- ) : null}
-
-
-
- >
- )
-}
-
-function WebPublicationListItem({
- webPub,
- hostname,
-}: {
- hostname: string
- webPub: WebPublicationRecord
-}) {
- const navigate = useNavigate()
- function goToItem() {
- navigate({
- key: 'publication',
- documentId: webPub.documentId,
- versionId: webPub.version,
- })
- }
- const popoverState = usePopoverState()
- const {deleteDialog, ...dialogState} = useUnpublishDialog({
- pub: webPub,
- hostname,
- })
-
- const {data: publication} = usePublication({
- documentId: webPub.documentId,
- versionId: webPub.version,
- enabled: !!webPub.documentId,
- })
- const publishedWebHost = publication?.document
- ? publication.document.webUrl || 'https://mintter.com'
- : null
- const {data: author} = useAccount(publication?.document?.author)
- return (
-
- )
-}
diff --git a/frontend/packages/app/src/utils/navigation.tsx b/frontend/packages/app/src/utils/navigation.tsx
index 097aa78a55..afef37bfc0 100644
--- a/frontend/packages/app/src/utils/navigation.tsx
+++ b/frontend/packages/app/src/utils/navigation.tsx
@@ -18,10 +18,8 @@ export type HomeRoute = {key: 'home'}
export type GlobalPublications = {key: 'all-publications'}
export type ContactsRoute = {key: 'contacts'}
export type AccountRoute = {key: 'account'; accountId: string}
-export type SitesRoute = {key: 'sites'}
-export type SiteRoute = {key: 'site'; hostname: string}
-type PublicationVersionsAccessory = {key: 'versions'}
+type EntityVersionsAccessory = {key: 'versions'}
type PublicationCitationsAccessory = {key: 'citations'}
type PublicationCommentsAccessory = {key: 'comments'}
export type GroupPublicationRouteContext = {
@@ -43,7 +41,7 @@ export type PublicationRoute = {
blockId?: string
accessory?:
| null
- | PublicationVersionsAccessory
+ | EntityVersionsAccessory
| PublicationCitationsAccessory
| PublicationCommentsAccessory
}
@@ -59,14 +57,13 @@ export type GroupsRoute = {key: 'groups'}
export type GroupRoute = {
key: 'group'
groupId: string
+ accessory?: null | EntityVersionsAccessory
}
export type NavRoute =
| HomeRoute
| ContactsRoute
| AccountRoute
| SettingsRoute
- | SitesRoute
- | SiteRoute
| GroupsRoute
| GroupRoute
| PublicationRoute
@@ -100,7 +97,6 @@ export function getRouteKey(route: NavRoute): string {
if (route.key === 'account') return `account:${route.accountId}`
if (route.key === 'draft') return `draft:${route.draftId}`
if (route.key === 'publication') return `pub:${route.documentId}` // version changes and publication page remains mounted
- if (route.key === 'site') return `site:${route.hostname}`
return route.key
}