From 9d432d467df3d5ef3e0e9315a10d41458887f67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Tue, 14 Jan 2025 15:45:21 -0600 Subject: [PATCH] Style patch tabs --- src/components/Border.svelte | 22 +++- src/components/Changeset.svelte | 6 +- src/components/File.svelte | 5 +- src/components/Tab.svelte | 74 +++++++++++ src/views/repo/Patch.svelte | 223 +++++++++++++++++--------------- 5 files changed, 224 insertions(+), 106 deletions(-) create mode 100644 src/components/Tab.svelte diff --git a/src/components/Border.svelte b/src/components/Border.svelte index c1b6c58..c2c1751 100644 --- a/src/components/Border.svelte +++ b/src/components/Border.svelte @@ -11,10 +11,12 @@ styleHeight?: string; styleMinHeight?: string; styleWidth?: string; + styleDisplay?: string; styleCursor?: "default" | "pointer" | "text"; styleGap?: string; styleOverflow?: string; flatTop?: boolean; + flatBottom?: boolean; styleBackgroundColor?: string; styleFlexDirection?: string; styleAlignItems?: string; @@ -31,10 +33,12 @@ styleMinHeight, stylePosition, styleWidth, + styleDisplay = "flex", styleCursor = "default", styleGap = "0.5rem", styleOverflow, flatTop = false, + flatBottom = false, styleBackgroundColor = "var(--color-background-default)", styleFlexDirection = "row", styleAlignItems = "center", @@ -130,7 +134,6 @@ } .p3-3 { grid-area: p3-3; - display: flex; background-color: var(--local-background-color); } .p3-4 { @@ -196,6 +199,21 @@ .flat-top > .p2-5 { background-color: var(--local-button-color-1); } + + .flat-bottom > .p4-2, + .flat-bottom > .p4-4 { + background-color: transparent; + } + + .flat-bottom > .p4-1, + .flat-bottom > .p4-5, + .flat-bottom > .p5-3, + .flat-bottom > .p5-1, + .flat-bottom > .p5-2, + .flat-bottom > .p5-4, + .flat-bottom > .p5-5 { + background-color: var(--local-button-color-1); + } @@ -204,6 +222,7 @@ style:cursor={styleCursor} class="container" class:flat-top={flatTop} + class:flat-bottom={flatBottom} {onclick} role="button" tabindex={onclick !== undefined ? 0 : -1} @@ -226,6 +245,7 @@
{#each diff.files as file} -
+
.header { display: flex; - height: 3rem; align-items: center; - padding: 0 0.5rem 0 1rem; + height: 2.5rem; + padding-left: 1rem; z-index: 2; font-size: var(--font-size-small); } @@ -46,6 +46,7 @@ .container { position: relative; overflow-x: auto; + z-index: 1; } .container::after { position: absolute; diff --git a/src/components/Tab.svelte b/src/components/Tab.svelte new file mode 100644 index 0000000..29b7da6 --- /dev/null +++ b/src/components/Tab.svelte @@ -0,0 +1,74 @@ + + + + + +
+
+ {@render children()} +
+
diff --git a/src/views/repo/Patch.svelte b/src/views/repo/Patch.svelte index 5045fd5..451fdf0 100644 --- a/src/views/repo/Patch.svelte +++ b/src/views/repo/Patch.svelte @@ -27,7 +27,6 @@ import AssigneeInput from "@app/components/AssigneeInput.svelte"; import Border from "@app/components/Border.svelte"; - import Button from "@app/components/Button.svelte"; import Changeset from "@app/components/Changeset.svelte"; import CommentComponent from "@app/components/Comment.svelte"; import CopyableId from "@app/components/CopyableId.svelte"; @@ -40,6 +39,7 @@ import PatchTeaser from "@app/components/PatchTeaser.svelte"; import PatchTimeline from "@app/components/PatchTimeline.svelte"; import Sidebar from "@app/components/Sidebar.svelte"; + import Tab from "@app/components/Tab.svelte"; import TextInput from "@app/components/TextInput.svelte"; interface Props { @@ -335,8 +335,9 @@ } .patch-body { - margin: 1rem 0; + margin-bottom: 1rem; position: relative; + z-index: 1; } /* We put the background and clip-path in a separate element to prevent popovers being clipped in the main element. */ @@ -471,113 +472,131 @@ {/if}
- - - - - - - - - - - - -
- - - +
+ +
+ { + tab = "patch"; + }}> + Patch: {formatOid(patch.id)} + + + { + tab = "revisions"; + }}> + Revision: {formatOid(revisions.slice(-1)[0].id)} + latest + +
+
{#if tab === "patch"} -
- 1 - ? revisions[0].description.at(-1) - : undefined} - author={revisions[0].author} - reactions={revisions[0].reactions} - timestamp={revisions[0].timestamp} - body={revisions[0].description.slice(-1)[0].body} - reactOnComment={partial( - reactOnRevision, - config.publicKey, - revisions[0].id, - )} - editComment={roles.isDelegateOrAuthor( - config.publicKey, - repo.delegates.map(delegate => delegate.did), - revisions[0].author.did, - ) && partial(editRevision, revisions[0].id)}> - -
- -
- -
(hideTimeline = !hideTimeline)}> - Timeline + +
+ 1 + ? revisions[0].description.at(-1) + : undefined} + author={revisions[0].author} + reactions={revisions[0].reactions} + timestamp={revisions[0].timestamp} + body={revisions[0].description.slice(-1)[0].body} + reactOnComment={partial( + reactOnRevision, + config.publicKey, + revisions[0].id, + )} + editComment={roles.isDelegateOrAuthor( + config.publicKey, + repo.delegates.map(delegate => delegate.did), + revisions[0].author.did, + ) && partial(editRevision, revisions[0].id)}> +
-
- + + + + + + + + + + + + + +
+ +
(hideTimeline = !hideTimeline)}> + Timeline +
+
+ +
-
+
{:else} - {@const revision = revisions.slice(-1)[0]} - {#await loadHighlightedDiff(repo.rid, revision.base, revision.head) then diff} -
+ + {@const revision = revisions.slice(-1)[0]} + {#await loadHighlightedDiff(repo.rid, revision.base, revision.head) then diff} -
- {/await} + {/await} + {/if}