-
-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor UI for individual views #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FyreByrd
wants to merge
19
commits into
develop
Choose a base branch
from
refactor/clean-ui
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
8e52e6c
Improve project view/edit
FyreByrd 092479a
Extract pagination header to component
FyreByrd 5ed5c33
Move Status/Result to valibot
FyreByrd f0443b0
Break bucket icon logic into function
FyreByrd 353aa55
Revamp form field icons
FyreByrd fd67b6e
Improve job view/edit
FyreByrd b73b75d
Remove unneeded validation/query
FyreByrd 937d337
Tweak display of null client
FyreByrd 2777e11
Remove unneeded update pages
FyreByrd 044d5e0
Remove unneeded code
FyreByrd 85191df
Improve build view
FyreByrd 8979567
Improve release view
FyreByrd 90e989d
Tweak CSS
FyreByrd d57c510
Improve client view
FyreByrd 82605c5
Fix type issue
FyreByrd c77f701
Fix copy-paste artifact
FyreByrd c909044
Link to Scriptoria
FyreByrd 08ff76d
Remove link for request id
FyreByrd 94c24a0
Remove unused component
FyreByrd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| <script lang="ts"> | ||
| import IconContainer from '../icons/IconContainer.svelte'; | ||
| import IconButton, { type IconButtonProps } from './IconButton.svelte'; | ||
| import { Icons } from '$lib/icons'; | ||
|
|
||
| interface Props extends IconButtonProps { | ||
| returnTo?: string; | ||
| resetForm?: boolean; | ||
| } | ||
|
|
||
| let { | ||
| class: classes, | ||
| icon = Icons.Cancel, | ||
| label = 'Cancel', | ||
| returnTo: href, | ||
| resetForm = false, | ||
| ...rest | ||
| }: Props = $props(); | ||
| </script> | ||
|
|
||
| {#if !rest.children && href} | ||
| <a class={['btn btn-secondary', classes]} {href}> | ||
| <IconContainer {icon} width={20} /> | ||
| {label} | ||
| </a> | ||
| {:else} | ||
| <IconButton | ||
| type={resetForm ? 'reset' : 'button'} | ||
| class={['btn-secondary', classes]} | ||
| {icon} | ||
| {label} | ||
| {...rest} | ||
| /> | ||
| {/if} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <script lang="ts"> | ||
| import { onDestroy } from 'svelte'; | ||
| import IconContainer from '../icons/IconContainer.svelte'; | ||
| import { Icons } from '$lib/icons'; | ||
|
|
||
| interface Props { | ||
| value: string; | ||
| } | ||
|
|
||
| const { value }: Props = $props(); | ||
|
|
||
| let copied = $state(false); | ||
|
|
||
| let timeout: ReturnType<typeof setTimeout> | null = $state(null); | ||
|
|
||
| onDestroy(() => { | ||
| if (timeout) { | ||
| clearTimeout(timeout); | ||
| } | ||
| }); | ||
| </script> | ||
|
|
||
| <button | ||
| class="cursor-copy" | ||
| type="button" | ||
| onclick={() => { | ||
| if (value) { | ||
| navigator.clipboard.writeText(value).then( | ||
| () => { | ||
| copied = true; | ||
| if (timeout) { | ||
| clearTimeout(timeout); | ||
| } | ||
| timeout = setTimeout(() => { | ||
| copied = false; | ||
| }, 5000); | ||
| }, | ||
| (r) => console.log(r) | ||
| ); | ||
| } | ||
| }} | ||
| > | ||
| {#if copied} | ||
| <IconContainer icon={Icons.Checkmark} width={24} class="text-success" /> | ||
| {:else} | ||
| <IconContainer icon={Icons.Copy} width={24} /> | ||
| {/if} | ||
| </button> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <script lang="ts" module> | ||
| export interface IconButtonProps { | ||
| label?: string; | ||
| class?: ClassValue; | ||
| form?: string; | ||
| type?: HTMLButtonElement['type']; | ||
| icon?: IconType; | ||
| disabled?: boolean; | ||
| onclick?: ( | ||
| e: MouseEvent & { | ||
| currentTarget: EventTarget & HTMLButtonElement; | ||
| } | ||
| ) => void; | ||
| children?: Snippet; | ||
| } | ||
| </script> | ||
|
|
||
| <script lang="ts"> | ||
| import type { Snippet } from 'svelte'; | ||
| import type { ClassValue } from 'svelte/elements'; | ||
| import IconContainer from '../icons/IconContainer.svelte'; | ||
| import { type IconType, Icons } from '$lib/icons'; | ||
|
FyreByrd marked this conversation as resolved.
|
||
|
|
||
| let { | ||
| form, | ||
| type = 'button', | ||
| class: classes, | ||
| icon = Icons.Save, | ||
| disabled = false, | ||
| label = 'Save', | ||
| onclick, | ||
| children | ||
| }: IconButtonProps = $props(); | ||
| </script> | ||
|
|
||
| <button {type} {form} class={['btn', classes]} {disabled} {onclick}> | ||
| {#if children} | ||
| {@render children()} | ||
| {:else} | ||
| <IconContainer {icon} width={20} /> | ||
| {label} | ||
| {/if} | ||
| </button> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| <!-- | ||
| @component | ||
| An input slot with an inline message (stylized) | ||
|
|
||
| --> | ||
| <script lang="ts"> | ||
| import type { Snippet } from 'svelte'; | ||
| import type { ClassValue } from 'svelte/elements'; | ||
|
|
||
| interface Props { | ||
| title?: { label?: string; class?: ClassValue }; | ||
| message?: { label?: string; class?: ClassValue }; | ||
| class?: ClassValue; | ||
| children?: Snippet; | ||
| } | ||
|
|
||
| let { title, message, class: classes, children }: Props = $props(); | ||
| </script> | ||
|
|
||
| <label class={['flex flex-row items-center gap-2', classes]}> | ||
| <div class="fieldset-label flex-col items-start grow text-base-content"> | ||
| {#if title} | ||
| <span class={['title', title.class]}> | ||
| {title.label} | ||
| </span> | ||
| {/if} | ||
| {#if message} | ||
| <span class={['text-sm', message.class]}> | ||
| {message.label} | ||
| </span> | ||
| {/if} | ||
| </div> | ||
| {@render children?.()} | ||
| </label> | ||
|
|
||
| <style> | ||
| .title { | ||
| font-weight: bold; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <script lang="ts"> | ||
| import type { Prisma } from '@prisma/client'; | ||
| import type { ClassValue } from 'svelte/elements'; | ||
| import { env } from '$env/dynamic/public'; | ||
| import { Icons } from '$lib/icons'; | ||
| import IconContainer from '$lib/icons/IconContainer.svelte'; | ||
|
|
||
| interface Props { | ||
| client: Prisma.clientGetPayload<{ select: { development: true } }> | null; | ||
| bucket: Prisma.projectGetPayload<{ select: { url: true } }>['url']; | ||
| scope: 'project' | 'job' | 'build' | 'release'; | ||
| id: number; | ||
| class?: ClassValue; | ||
| } | ||
|
|
||
| let { client, bucket, scope, id, class: classes }: Props = $props(); | ||
| </script> | ||
|
|
||
| <a | ||
| class={['link', classes]} | ||
| target="_blank" | ||
| href="{client?.development | ||
| ? 'http://localhost:6173' | ||
| : env.PUBLIC_SCRIPTORIA_URL}/link/{scope}/{id}{bucket && | ||
| `?bucket=${encodeURIComponent(bucket)}`}" | ||
| > | ||
| View in Scriptoria <IconContainer icon={Icons.Open} width={16} /> | ||
| </a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <script lang="ts"> | ||
| interface Props { | ||
| page: { page: number; size: number }; | ||
| count: number; | ||
| } | ||
|
|
||
| const { page, count }: Props = $props(); | ||
| </script> | ||
|
|
||
| <p> | ||
| Showing <b> | ||
| {Math.min(page.page * page.size + 1, count)}-{Math.min((page.page + 1) * page.size, count)} | ||
|
FyreByrd marked this conversation as resolved.
|
||
| </b> | ||
| of | ||
| <b>{count}</b> | ||
| items | ||
| </p> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <script lang="ts" generics="T"> | ||
| import LabeledFormInput, { | ||
| type Props as LabelProps | ||
| } from '$lib/components/LabeledFormInput.svelte'; | ||
| import { Icons } from '$lib/icons'; | ||
| import IconContainer from '$lib/icons/IconContainer.svelte'; | ||
|
|
||
| interface Props extends LabelProps { | ||
| value?: T; | ||
| } | ||
| let { value = $bindable(), ...rest }: Props = $props(); | ||
|
|
||
| let visible = $state(false); | ||
| </script> | ||
|
|
||
| {#snippet after()} | ||
| <button type="button" onclick={() => (visible = !visible)}> | ||
| <IconContainer icon={visible ? Icons.Visible : Icons.Invisible} width={16} /> | ||
| </button> | ||
| {/snippet} | ||
|
FyreByrd marked this conversation as resolved.
|
||
|
|
||
| <LabeledFormInput | ||
| {...rest} | ||
| input={{ | ||
| ...rest.input, | ||
| type: visible ? 'text' : 'password', | ||
| icon: rest.input?.icon ?? Icons.Key, | ||
| after | ||
| }} | ||
| bind:value | ||
| /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.