Skip to content

Commit

Permalink
Doing responsivness improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastinez committed Jun 14, 2024
1 parent 7c4f396 commit 9f0e2c3
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 158 deletions.
32 changes: 4 additions & 28 deletions src/views/projects/History.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Node,
Tree,
} from "@http-client";
import type { Route } from "@app/lib/router";
import { COMMITS_PER_PAGE } from "./router";
import { HttpdClient } from "@http-client";
Expand All @@ -26,7 +25,6 @@
export let baseUrl: BaseUrl;
export let node: Node;
export let commit: string;
export let branches: string[];
export let commitHeaders: CommitHeader[];
export let peer: string | undefined;
export let peers: Remote[];
Expand Down Expand Up @@ -63,28 +61,6 @@
}
loading = false;
}
$: peersWithRoute = peers.map(remote => ({
remote,
selected: remote.id === peer,
route: {
resource: "project.history",
node: baseUrl,
project: project.id,
peer: remote.id,
} as Route,
}));
$: branchesWithRoute = branches.map(name => ({
name,
route: {
resource: "project.history",
node: baseUrl,
project: project.id,
peer,
revision: name,
} as Route,
}));
</script>

<style>
Expand All @@ -111,15 +87,15 @@
<Layout {node} {baseUrl} {project} activeTab="source">
<ProjectNameHeader {project} {baseUrl} {seeding} slot="header" />

<div style:margin="1rem 0 1rem 1rem" slot="subheader">
<div style:margin="1rem 1rem 1rem 1rem" slot="subheader">
<Header
node={baseUrl}
{commit}
{peers}
{peer}
{project}
peers={peersWithRoute}
branches={branchesWithRoute}
{revision}
{tree}
node={baseUrl}
filesLinkActive={false}
historyLinkActive={true} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/projects/Source.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<Layout {node} {baseUrl} {project} activeTab="source" stylePaddingBottom="0">
<ProjectNameHeader {project} {baseUrl} {seeding} slot="header" />

<div style:margin="1rem 0 1rem 1rem" slot="subheader">
<div style:margin="1rem 1rem 1rem 1rem" slot="subheader">
<Header
filesLinkActive={true}
historyLinkActive={false}
Expand Down
96 changes: 0 additions & 96 deletions src/views/projects/Source/BranchSelector.svelte

This file was deleted.

9 changes: 7 additions & 2 deletions src/views/projects/Source/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
display: flex;
align-items: center;
justify-content: left;
row-gap: 0.5rem;
gap: 1rem;
flex-wrap: wrap;
margin-bottom: 2rem;
}
Expand Down Expand Up @@ -89,8 +91,11 @@
{node}
{project}
{selectedBranch} />
<div class="global-spacer" />
<CommitButton projectId={project.id} commit={lastCommit} baseUrl={node} />
<CommitButton
projectId={project.id}
commit={lastCommit}
baseUrl={node}
styleRoundBorders />
</div>

<div class="header">
Expand Down
71 changes: 41 additions & 30 deletions src/views/projects/Source/SourceSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import PeerItem from "./SourceSelector/PeerItem.svelte";
import Popover, { closeFocused } from "@app/components/Popover.svelte";
import TextInput from "@app/components/TextInput.svelte";
import Avatar from "@app/components/Avatar.svelte";
export let peers: Remote[];
export let peer: string | undefined;
Expand Down Expand Up @@ -54,8 +55,9 @@
}
</style>

<div style="display: flex; gap: 1px;">
<div style="display: flex; gap: 1px; min-width: 0; flex-wrap: nowrap;">
<Popover
popoverContainerMinWidth="0"
popoverPadding="0"
popoverPositionTop="2.5rem"
popoverBorderRadius="var(--border-radius-small)">
Expand All @@ -64,27 +66,37 @@
let:expanded
let:toggle
styleBorderRadius="var(--border-radius-tiny) 0 0 var(--border-radius-tiny)"
styleWidth="100%"
on:click={toggle}
title="Change peer"
disabled={!peers}>
{#if selectedPeer}
<NodeId
nodeId={selectedPeer.id}
alias={selectedPeer.alias}
stylePopoverPositionLeft="-0.75rem" />
{#if selectedPeer.delegate}
<Badge size="tiny" variant="delegate">
<IconSmall name="badge" />
Delegate
</Badge>
{/if}
<div class="global-hide-on-medium-desktop-up" style="height: 1rem;">
<Avatar nodeId={selectedPeer.id} />
</div>
<div
class="global-hide-on-small-desktop-down"
style="display: flex; gap: 0.5rem; align-items: center;">
<NodeId
nodeId={selectedPeer.id}
alias={selectedPeer.alias}
stylePopoverPositionLeft="-0.75rem" />
{#if selectedPeer.delegate}
<Badge size="tiny" variant="delegate">
<IconSmall name="badge" />
Delegate
</Badge>
{/if}
</div>
{/if}
{#if selectedPeer && selectedBranch}
<span>/</span>
{/if}
{#if selectedBranch}
<IconSmall name="branch" />
{selectedBranch}
<span class="txt-overflow">
{selectedBranch}
</span>
{#if onCanonical}
<Badge title="Canonical branch" variant="foreground-emphasized">
Canonical
Expand Down Expand Up @@ -165,7 +177,7 @@
</div>
<div
class="txt-monospace"
style="color: var(--color-foreground-dim);">
style="color: var(--color-foreground-dim); padding-left: 0.5rem;">
{formatCommit(parsedResult.head)}
</div>
</DropdownListItem>
Expand Down Expand Up @@ -203,7 +215,7 @@
</div>
<div
class="txt-monospace"
style="color: var(--color-foreground-dim);">
style="color: var(--color-foreground-dim); padding-left: 0.5rem;">
{formatCommit(project.head)}
</div>
</DropdownListItem>
Expand All @@ -219,20 +231,19 @@
</div>
</div>
</Popover>
{#if selectedPeer}
<Link
route={{
resource: "project.source",
project: project.id,
node,
path: "/",
}}>
<Button
variant="not-selected"
styleBorderRadius="0 var(--border-radius-tiny) var(--border-radius-tiny) 0">
<IconSmall name="cross" />
</Button>
</Link>
{/if}
</div>
<div class="global-spacer"></div>
{#if selectedPeer}
<Link
route={{
resource: "project.source",
project: project.id,
node,
path: "/",
}}>
<Button
variant="not-selected"
styleBorderRadius="0 var(--border-radius-tiny) var(--border-radius-tiny) 0">
<IconSmall name="cross" />
</Button>
</Link>
{/if}
2 changes: 1 addition & 1 deletion src/views/projects/components/CommitButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<div class="identifier global-commit">
{commitShortId}
</div>
<span class="global-hide-on-small-desktop-down">
<span>
{commit.summary}
</span>
</div>
Expand Down

0 comments on commit 9f0e2c3

Please sign in to comment.