import { Route, Router } from '@solidjs/router';
import type { Component } from 'solid-js';
import { RootShell } from './layout';
import {
BlobPage,
CommitPage,
CommitsPage,
ForkRepoPage,
IssuePage,
IssuesPage,
NewIssuePage,
NewPullPage,
NewRepoPage,
PullPage,
PullsPage,
RepoCodePage,
} from './pages/repo';
import { RepoLayout } from './pages/repo/shared';
import { HomePage } from './pages/home';
import { NotFoundPage } from './pages/not-found';
import { OAuthCallbackPage } from './pages/oauth-callback';
import { SearchPage } from './pages/search';
import { ProfilePage } from './pages/profile';
import { StringPage, RawStringPage, NewStringPage, EditStringPage } from './pages/string';
import {
SettingsLayout,
AppSettingsTab,
ProfileSettingsTab,
KeysSettingsTab,
EmailsSettingsTab,
NotificationsSettingsTab,
KnotsSettingsTab,
KnotDashboardTab,
SpindlesSettingsTab,
SpindleDashboardTab,
} from './pages/settings';
export const AppRoutes: Component = () => (
<Router root={RootShell}>
<Route path="/" component={HomePage} />
<Route path="/search" component={SearchPage} />
<Route path="/oauth/callback" component={OAuthCallbackPage} />
<Route path="/strings/new" component={NewStringPage} />
<Route path="/strings/:actor/:rkey" component={StringPage} />
<Route path="/strings/:actor/:rkey/edit" component={EditStringPage} />
<Route path="/strings/:actor/:rkey/raw" component={RawStringPage} />
<Route path="/repo/new" component={NewRepoPage} />
<Route path="/settings" component={SettingsLayout}>
<Route path="/" component={AppSettingsTab} />
<Route path="/app" component={AppSettingsTab} />
<Route path="/profile" component={ProfileSettingsTab} />
<Route path="/keys" component={KeysSettingsTab} />
<Route path="/emails" component={EmailsSettingsTab} />
<Route path="/notifications" component={NotificationsSettingsTab} />
<Route path="/knots" component={KnotsSettingsTab} />
<Route path="/knots/:domain" component={KnotDashboardTab} />
<Route path="/spindles" component={SpindlesSettingsTab} />
<Route path="/spindles/:domain" component={SpindleDashboardTab} />
</Route>
<Route path="/:owner/:repo" component={RepoLayout}>
<Route path="/" component={RepoCodePage} />
<Route path="/issues/new" component={NewIssuePage} />
<Route path="/issues/:issueRef" component={IssuePage} />
<Route path="/issues" component={IssuesPage} />
<Route path="/pulls/new" component={NewPullPage} />
<Route path="/pulls/:pullRef" component={PullPage} />
<Route path="/pulls" component={PullsPage} />
<Route path="/commits" component={CommitsPage} />
<Route path="/commits/:ref" component={CommitsPage} />
<Route path="/commit/:ref" component={CommitPage} />
<Route path="/fork" component={ForkRepoPage} />
<Route path="/blob/:ref/*path" component={BlobPage} />
<Route path="/tree/:ref/*path" component={RepoCodePage} />
</Route>
<Route path="/:actor" component={ProfilePage} />
<Route path="*404" component={NotFoundPage} />
</Router>
);