Redesign node view and use it as the landing-page

This commit is contained in:
Rūdolfs Ošiņš
2024-07-26 10:20:01 +02:00
parent 266afb17c8
commit c0049f83ba
50 changed files with 1051 additions and 1021 deletions
-34
View File
@@ -1,34 +0,0 @@
<script lang="ts">
import Breadcrumbs from "./Header/Breadcrumbs.svelte";
import Link from "@app/components/Link.svelte";
</script>
<style>
header {
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
padding: 0.5rem 1rem;
height: 3.5rem;
}
.logo {
height: var(--button-regular-height);
margin: 0 0.5rem;
}
</style>
<header>
<Link
style="display: flex; align-items: center;"
route={{ resource: "home" }}>
<img
width="24"
height="24"
class="logo"
alt="Radicle logo"
src="/radicle.svg" />
</Link>
<Breadcrumbs />
</header>
-41
View File
@@ -1,41 +0,0 @@
<script lang="ts">
import * as router from "@app/lib/router";
import * as utils from "@app/lib/utils";
import NodeSegment from "./Breadcrumbs/NodeSegment.svelte";
import ProjectSegment from "./Breadcrumbs/ProjectSegment.svelte";
import Separator from "./Breadcrumbs/Separator.svelte";
const activeRouteStore = router.activeRouteStore;
</script>
<style>
.breadcrumbs {
display: flex;
align-items: center;
column-gap: 0.25rem;
line-height: 1rem;
font-weight: var(--font-weight-semibold);
font-size: var(--font-size-small);
white-space: nowrap;
flex-wrap: wrap;
}
</style>
{#if $activeRouteStore.resource === "booting" || $activeRouteStore.resource === "home" || $activeRouteStore.resource === "error" || $activeRouteStore.resource === "notFound"}
<!-- Don't render breadcrumbs for these routes. -->
{:else if $activeRouteStore.resource === "nodes"}
<div class="breadcrumbs">
<NodeSegment baseUrl={$activeRouteStore.params.baseUrl} />
</div>
{:else if $activeRouteStore.resource === "project.source" || $activeRouteStore.resource === "project.history" || $activeRouteStore.resource === "project.commit" || $activeRouteStore.resource === "project.issues" || $activeRouteStore.resource === "project.issue" || $activeRouteStore.resource === "project.patches" || $activeRouteStore.resource === "project.patch"}
<div class="breadcrumbs">
<NodeSegment baseUrl={$activeRouteStore.params.baseUrl} />
<Separator />
<ProjectSegment activeRoute={$activeRouteStore} />
</div>
{:else}
{utils.unreachable($activeRouteStore)}
{/if}
@@ -1,29 +0,0 @@
<script lang="ts">
import type { BaseUrl } from "@http-client";
import IconSmall from "@app/components/IconSmall.svelte";
import Link from "@app/components/Link.svelte";
export let baseUrl: BaseUrl;
</script>
<style>
.segment :global(a:hover) {
color: var(--color-fill-secondary);
}
</style>
<span class="segment">
<Link
style="display: flex; align-items: center; gap: 0.25rem;"
route={{
resource: "nodes",
params: {
baseUrl,
projectPageIndex: 0,
},
}}>
<IconSmall name="seedling" />
{baseUrl.hostname}
</Link>
</span>
@@ -1,127 +0,0 @@
<script lang="ts">
import type { ProjectLoadedRoute } from "@app/views/projects/router";
import { formatObjectId, unreachable } from "@app/lib/utils";
import FilePath from "@app/components/FilePath.svelte";
import IconSmall from "@app/components/IconSmall.svelte";
import Link from "@app/components/Link.svelte";
import Separator from "./Separator.svelte";
export let activeRoute: ProjectLoadedRoute;
</script>
<style>
.segment {
display: flex;
align-items: center;
gap: 0.25rem;
}
.segment :global(a:hover) {
color: var(--color-fill-secondary);
}
.id {
font-size: var(--font-size-small);
font-family: var(--font-family-monospace);
font-weight: var(--font-weight-semibold);
}
</style>
<span class="segment">
<Link
route={{
resource: "project.source",
project: activeRoute.params.project.id,
node: activeRoute.params.baseUrl,
}}>
<div class="segment">
{#if activeRoute.params.project.visibility?.type === "private"}
<IconSmall name="lock" />
{/if}
{activeRoute.params.project.name}
</div>
</Link>
</span>
<span class="segment">
{#if activeRoute.resource === "project.history"}
<Separator />
<Link
route={{
resource: "project.history",
project: activeRoute.params.project.id,
node: activeRoute.params.baseUrl,
}}>
Commits
</Link>
{:else if activeRoute.resource === "project.commit"}
<Separator />
<Link
route={{
resource: "project.history",
project: activeRoute.params.project.id,
node: activeRoute.params.baseUrl,
}}>
Commits
</Link>
{:else if activeRoute.resource === "project.issue" || activeRoute.resource === "project.issues"}
<Separator />
<Link
route={{
resource: "project.issues",
project: activeRoute.params.project.id,
node: activeRoute.params.baseUrl,
}}>
Issues
</Link>
{:else if activeRoute.resource === "project.patch" || activeRoute.resource === "project.patches"}
<Separator />
<Link
route={{
resource: "project.patches",
project: activeRoute.params.project.id,
node: activeRoute.params.baseUrl,
}}>
Patches
</Link>
{:else if activeRoute.resource === "project.source"}
{#if activeRoute.params.path !== "/"}
<Separator />
<FilePath filenameWithPath={activeRoute.params.path} />
{/if}
{:else}
{unreachable(activeRoute)}
{/if}
</span>
{#if activeRoute.resource === "project.commit"}
<Separator />
<span class="id">
<div class="global-hide-on-small-desktop-down">
{activeRoute.params.commit.commit.id}
</div>
<div class="global-hide-on-medium-desktop-up">
{formatObjectId(activeRoute.params.commit.commit.id)}
</div>
</span>
{:else if activeRoute.resource === "project.issue"}
<Separator />
<span class="id">
<div class="global-hide-on-small-desktop-down">
{activeRoute.params.issue.id}
</div>
<div class="global-hide-on-medium-desktop-up">
{formatObjectId(activeRoute.params.issue.id)}
</div>
</span>
{:else if activeRoute.resource === "project.patch"}
<Separator />
<span class="id">
<div class="global-hide-on-small-desktop-down">
{activeRoute.params.patch.id}
</div>
<div class="global-hide-on-medium-desktop-up">
{formatObjectId(activeRoute.params.patch.id)}
</div>
</span>
{/if}
@@ -1,7 +0,0 @@
<script lang="ts">
import IconSmall from "@app/components/IconSmall.svelte";
</script>
<span style:color="var(--color-foreground-dim)">
<IconSmall name="chevron-right" />
</span>
@@ -1,7 +1,7 @@
<script lang="ts">
import Footer from "@app/App/Footer.svelte";
import Header from "@app/App/Header.svelte";
import MobileFooter from "@app/App/MobileFooter.svelte";
import Link from "@app/components/Link.svelte";
</script>
<style>
@@ -12,11 +12,23 @@
}
.header {
border-bottom: 1px solid var(--color-fill-separator);
display: flex;
align-items: center;
gap: 0.5rem;
margin: 0;
padding: 0.5rem 0.5rem 0.5rem 1rem;
height: 3.5rem;
justify-content: flex-end;
}
.content {
height: 100%;
overflow-y: scroll;
}
.logo {
height: var(--button-regular-height);
margin: 0 0.5rem;
}
@media (max-width: 719.98px) {
.app {
display: grid;
@@ -31,7 +43,16 @@
<div class="app">
<div class="global-hide-on-mobile-down header">
<Header />
<Link
style="display: flex; align-items: center;"
route={{ resource: "nodes", params: undefined }}>
<img
width="24"
height="24"
class="logo"
alt="Radicle logo"
src="/radicle.svg" />
</Link>
</div>
<div class="content">
<slot />
+1 -1
View File
@@ -28,7 +28,7 @@
<div class="mobile-footer">
<Link
style="width: 100%; display: flex; align-items: center; justify-content: center;"
route={{ resource: "home" }}>
route={{ resource: "nodes", params: undefined }}>
<img
width="16"
height="16"