Skip to content

Commit

Permalink
feat: status page improvements (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
AyushSehrawat authored Jan 26, 2024
1 parent eb5f201 commit ff3cb20
Show file tree
Hide file tree
Showing 39 changed files with 158 additions and 224 deletions.
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"mode-watcher": "^0.1.2",
"motion": "^10.17.0",
"nprogress": "^0.2.0",
"svelte-sonner": "^0.3.6",
"sveltekit-superforms": "^1.13.1",
"svelte-sonner": "^0.3.11",
"sveltekit-superforms": "^1.13.4",
"tailwind-merge": "^2.2.0",
"tailwind-variants": "^0.1.18",
"uuid": "^9.0.1",
Expand Down
4 changes: 2 additions & 2 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
export { className as class };
</script>

<AccordionPrimitive.Item
{value}
class={cn("border-b", className)}
{...$$restProps}
>
<AccordionPrimitive.Item {value} class={cn("border-b", className)} {...$$restProps}>
<slot />
</AccordionPrimitive.Item>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
</script>

<AlertDialogPrimitive.Cancel
class={cn(
buttonVariants({ variant: "outline" }),
"mt-2 sm:mt-0",
className
)}
class={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
{...$$restProps}
on:click
on:keydown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
</script>

<div
class={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
class={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
{...$$restProps}
>
<slot />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
export { className as class };
</script>

<div
class={cn("flex flex-col space-y-2 text-center sm:text-left", className)}
{...$$restProps}
>
<div class={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...$$restProps}>
<slot />
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<AlertDialogPrimitive.Overlay
{transition}
{transitionConfig}
class={cn(
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ",
className
)}
class={cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ", className)}
{...$$restProps}
/>
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
export { className as class };
</script>

<AlertDialogPrimitive.Title
class={cn("text-lg font-semibold", className)}
{level}
{...$$restProps}
>
<AlertDialogPrimitive.Title class={cn("text-lg font-semibold", className)} {level} {...$$restProps}>
<slot />
</AlertDialogPrimitive.Title>
6 changes: 1 addition & 5 deletions frontend/src/lib/components/ui/alert/alert.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
export { className as class };
</script>

<div
class={cn(alertVariants({ variant }), className)}
{...$$restProps}
role="alert"
>
<div class={cn(alertVariants({ variant }), className)} {...$$restProps} role="alert">
<slot />
</div>
3 changes: 1 addition & 2 deletions frontend/src/lib/components/ui/badge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ export const badgeVariants = tv({
base: "inline-flex items-center border rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none select-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
variants: {
variant: {
default:
"bg-primary hover:bg-primary/80 border-transparent text-primary-foreground",
default: "bg-primary hover:bg-primary/80 border-transparent text-primary-foreground",
secondary:
"bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground",
destructive:
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/lib/components/ui/button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ const buttonVariants = tv({
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-destructive-foreground hover:bg-destructive/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline:
"border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/card/card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
</script>

<div
class={cn(
"rounded-lg border bg-card text-card-foreground shadow-sm",
className
)}
class={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
{...$$restProps}
>
<slot />
Expand Down
17 changes: 15 additions & 2 deletions frontend/src/lib/components/ui/carousel/carousel-content.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,29 @@
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements";
import { getEmblaContext } from "./context.js";
import emblaCarouselSvelte from "embla-carousel-svelte";
type $$Props = HTMLAttributes<HTMLDivElement>;
let className: string | undefined | null = undefined;
export { className as class };
const { orientation } = getEmblaContext("<Carousel.Content/>");
const { orientation, options, plugins, onInit } = getEmblaContext("<Carousel.Content/>");
</script>

<div class="overflow-hidden">
<div
class="overflow-hidden"
use:emblaCarouselSvelte={{
options: {
container: "[data-embla-container]",
slides: "[data-embla-slide]",
...$options,
axis: $orientation === "horizontal" ? "x" : "y"
},
plugins: $plugins
}}
on:emblaInit={onInit}
>
<div
class={cn("flex", $orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col", className)}
data-embla-container=""
Expand Down
20 changes: 8 additions & 12 deletions frontend/src/lib/components/ui/carousel/carousel.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts">
import emblaCarouselSvelte from "embla-carousel-svelte";
import { setEmblaContex, type CarouselProps, type CarouselAPI } from "./context.js";
import { cn } from "$lib/utils.js";
import { writable } from "svelte/store";
Expand All @@ -19,8 +18,12 @@
const orientationStore = writable(orientation);
const canScrollPrev = writable(false);
const canScrollNext = writable(false);
const optionsStore = writable(opts);
const pluginStore = writable(plugins);
$: orientationStore.set(orientation);
$: pluginStore.set(plugins);
$: optionsStore.set(opts);
function scrollPrev() {
api?.scrollPrev();
Expand Down Expand Up @@ -58,7 +61,10 @@
orientation: orientationStore,
canScrollNext,
canScrollPrev,
handleKeyDown
handleKeyDown,
options: optionsStore,
plugins: pluginStore,
onInit
});
function onInit(event: CustomEvent<CarouselAPI>) {
Expand All @@ -73,16 +79,6 @@

<div
class={cn("relative", className)}
use:emblaCarouselSvelte={{
options: {
container: "[data-embla-container]",
slides: "[data-embla-slide]",
...opts,
axis: $orientationStore === "horizontal" ? "x" : "y"
},
plugins
}}
on:emblaInit={onInit}
on:mouseenter
on:mouseleave
role="region"
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/components/ui/carousel/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type EmblaContext = {
canScrollNext: Readable<boolean>;
canScrollPrev: Readable<boolean>;
handleKeyDown: (e: KeyboardEvent) => void;
options: Writable<CarouselOptions>;
plugins: Writable<CarouselPlugins>;
onInit: (e: CustomEvent<CarouselAPI>) => void;
};

export function setEmblaContex(config: EmblaContext): EmblaContext {
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/command/command-empty.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
export { className as class };
</script>

<CommandPrimitive.Empty
class={cn("py-6 text-center text-sm", className)}
{...$$restProps}
>
<CommandPrimitive.Empty class={cn("py-6 text-center text-sm", className)} {...$$restProps}>
<slot />
</CommandPrimitive.Empty>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@
export { className as class };
</script>

<CommandPrimitive.Separator
class={cn("-mx-1 h-px bg-border", className)}
{...$$restProps}
/>
<CommandPrimitive.Separator class={cn("-mx-1 h-px bg-border", className)} {...$$restProps} />
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
</script>

<span
class={cn(
"ml-auto text-xs tracking-widest text-muted-foreground",
className
)}
class={cn("ml-auto text-xs tracking-widest text-muted-foreground", className)}
{...$$restProps}
>
<slot />
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/dialog/dialog-footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
</script>

<div
class={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className
)}
class={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
{...$$restProps}
>
<slot />
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/dialog/dialog-header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
export { className as class };
</script>

<div
class={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)}
{...$$restProps}
>
<div class={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...$$restProps}>
<slot />
</div>
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/dialog/dialog-overlay.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<DialogPrimitive.Overlay
{transition}
{transitionConfig}
class={cn(
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm",
className
)}
class={cn("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm", className)}
{...$$restProps}
/>
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
export { className as class };
</script>

<span
class={cn("ml-auto text-xs tracking-widest opacity-60", className)}
{...$$restProps}
>
<span class={cn("ml-auto text-xs tracking-widest opacity-60", className)} {...$$restProps}>
<slot />
</span>
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/form/form-description.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
export { className as class };
</script>

<FormPrimitive.Description
class={cn("text-sm text-muted-foreground", className)}
{...$$restProps}
>
<FormPrimitive.Description class={cn("text-sm text-muted-foreground", className)} {...$$restProps}>
<slot />
</FormPrimitive.Description>
6 changes: 1 addition & 5 deletions frontend/src/lib/components/ui/form/form-label.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
const { errors, ids } = getFormField();
</script>

<Label
for={$ids.input}
class={cn($errors && "text-destructive", className)}
{...$$restProps}
>
<Label for={$ids.input} class={cn($errors && "text-destructive", className)} {...$$restProps}>
<slot />
</Label>
15 changes: 5 additions & 10 deletions frontend/src/lib/components/ui/form/form-select-trigger.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@
placeholder?: string;
};
type $$Events = SelectPrimitive.TriggerEvents;
const { attrStore } = getFormField();
const { attrStore, value } = getFormField();
export let placeholder = "";
</script>

<Select.Trigger
{...$$restProps}
{...$attrStore}
on:click
on:keydown
type="button"
>
<Select.Value {placeholder} />
<slot />
<Select.Trigger {...$$restProps} {...$attrStore} on:click on:keydown type="button">
<slot value={$value}>
<Select.Value {placeholder} />
</slot>
</Select.Trigger>
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/form/form-textarea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
import { getFormField } from "formsnap";
import type { HTMLTextareaAttributes } from "svelte/elements";
import type { TextareaGetFormField } from ".";
import {
Textarea,
type TextareaEvents
} from "$lib/components/ui/textarea";
import { Textarea, type TextareaEvents } from "$lib/components/ui/textarea";
type $$Props = HTMLTextareaAttributes;
type $$Events = TextareaEvents;
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/lib/components/ui/form/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ const SelectGroup = SelectComp.Group;
const SelectItem = SelectComp.Item;
const SelectSeparator = SelectComp.Separator;

export type TextareaGetFormField = Omit<
ReturnType<typeof getFormField>,
"value"
> & {
export type TextareaGetFormField = Omit<ReturnType<typeof getFormField>, "value"> & {
value: Writable<string>;
};

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/ui/input/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export type InputEvents = {
change: FormInputEvent<Event>;
click: FormInputEvent<MouseEvent>;
focus: FormInputEvent<FocusEvent>;
focusin: FormInputEvent<FocusEvent>;
focusout: FormInputEvent<FocusEvent>;
keydown: FormInputEvent<KeyboardEvent>;
keypress: FormInputEvent<KeyboardEvent>;
keyup: FormInputEvent<KeyboardEvent>;
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/components/ui/input/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
on:change
on:click
on:focus
on:focusin
on:focusout
on:keydown
on:keypress
on:keyup
Expand Down
Loading

0 comments on commit ff3cb20

Please sign in to comment.