Skip to content

Commit f364e37

Browse files
Merge pull request #68 from MaddyGuthridge/maddy-usability-improvements
Various miscellaneous usability improvements
2 parents 37c0c60 + 6d3f58c commit f364e37

File tree

19 files changed

+193
-32
lines changed

19 files changed

+193
-32
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minifolio",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"private": true,
55
"license": "GPL-3.0-only",
66
"scripts": {

src/components/base/Button.svelte renamed to src/components/base/button/Button.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { tooltip } from '$lib/ui';
33
import type { Snippet } from 'svelte';
44
5-
type Props = {
5+
export type ButtonProps = {
66
/** Display mode for button (controls background color) */
77
mode?: 'default' | 'warning' | 'confirm';
88
/** Hint for button (controls tooltip and aria-label) */
@@ -29,7 +29,7 @@
2929
disabled,
3030
onclick,
3131
mode = 'default',
32-
}: Props = $props();
32+
}: ButtonProps = $props();
3333
3434
let { color, hoverColor, clickColor } = $derived.by(() => {
3535
if (mode === 'warning') {

src/components/CopyButton.svelte renamed to src/components/base/button/CopyButton.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { Button } from './base';
2+
import Button from './Button.svelte';
33
44
type Props = {
55
text: string;
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<script lang="ts">
2+
import Button, { type ButtonProps } from './Button.svelte';
3+
4+
// TypeScript seems to have it figured out, so not sure what ESLint is thinking :/
5+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
6+
type Props = ButtonProps & { running: boolean };
7+
8+
const { children, running, ...rest }: Props = $props();
9+
</script>
10+
11+
<Button {...rest}>
12+
<div>
13+
{#if running}
14+
<div class="spin">
15+
<i class="las la-sync"></i>
16+
</div>
17+
{/if}
18+
{@render children()}
19+
</div>
20+
</Button>
21+
22+
<style>
23+
div {
24+
display: flex;
25+
gap: 10px;
26+
}
27+
28+
@keyframes rotating {
29+
from {
30+
transform: rotate(0deg);
31+
}
32+
to {
33+
transform: rotate(360deg);
34+
}
35+
}
36+
.spin {
37+
display: flex;
38+
align-items: center;
39+
justify-content: center;
40+
animation: rotating 2s linear infinite;
41+
}
42+
</style>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export { default as CopyButton } from './CopyButton.svelte';
2+
export { default as SpinnerButton } from './SpinnerButton.svelte';
3+
4+
import Button from './Button.svelte';
5+
export default Button;

src/components/base/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { default as Button } from './Button.svelte';
1+
export { default as Button } from './button';
22
export { default as Select } from './Select.svelte';
33
export { default as TextInput } from './TextInput.svelte';
44
export { default as TextArea } from './TextArea.svelte';

src/components/card/ItemCard.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
.card-outer {
7070
display: flex;
7171
flex-direction: column;
72+
justify-content: center;
7273
height: 100%;
7374
}
7475

src/components/navbar/ControlButtons.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { dev } from '$app/environment';
33
import { goto } from '$app/navigation';
4-
import Button from '$components/base/Button.svelte';
4+
import Button from '$components/base/button/Button.svelte';
55
import Separator from '$components/Separator.svelte';
66
import api from '$endpoints';
77

src/endpoints/admin/git.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export default (fetchFn: typeof fetch, token: string | undefined) => ({
5555
).json() as Promise<RepoStatus>;
5656
},
5757

58+
/** Perform a git fetch */
59+
fetch: async () => {
60+
return apiFetch(
61+
fetchFn,
62+
'POST',
63+
'/api/admin/git/fetch',
64+
{ token },
65+
).json() as Promise<RepoStatus>;
66+
},
67+
5868
/** Perform a git push */
5969
push: async () => {
6070
return apiFetch(

0 commit comments

Comments
 (0)