From 56bcecf6cf92330dd720bafd8cfccd1cbec2016a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 26 Nov 2024 13:54:33 +0100 Subject: [PATCH 1/4] chore: fix prettier formatter. Ignore symlinked asciinema-player --- formatter.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/formatter.nix b/formatter.nix index 6805d6ab1..03d4bb333 100644 --- a/formatter.nix +++ b/formatter.nix @@ -43,6 +43,9 @@ "*.yaml" "*.yml" ]; + excludes = [ + "*/asciinema-player/*" + ]; }; treefmt.programs.mypy.directories = { From ce12fbd19b6cbd450f3a5e435cd519de44d343d2 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 26 Nov 2024 13:54:58 +0100 Subject: [PATCH 2/4] UI/components: init icon --- .../app/src/components/icon/index.tsx | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 pkgs/webview-ui/app/src/components/icon/index.tsx diff --git a/pkgs/webview-ui/app/src/components/icon/index.tsx b/pkgs/webview-ui/app/src/components/icon/index.tsx new file mode 100644 index 000000000..175c44bf6 --- /dev/null +++ b/pkgs/webview-ui/app/src/components/icon/index.tsx @@ -0,0 +1,91 @@ +import { Component, JSX } from "solid-js"; +import ArrowBottom from "@/icons/arrow-bottom.svg"; +import ArrowLeft from "@/icons/arrow-left.svg"; +import ArrowRight from "@/icons/arrow-right.svg"; +import ArrowTop from "@/icons/arrow-top.svg"; +import CaretDown from "@/icons/caret-down.svg"; +import CaretRight from "@/icons/caret-right.svg"; +import Checkmark from "@/icons/checkmark.svg"; +import ClanIcon from "@/icons/clan-icon.svg"; +import ClanLogo from "@/icons/clan-logo.svg"; +import Edit from "@/icons/edit.svg"; +import Expand from "@/icons/expand.svg"; +import EyeClose from "@/icons/eye-close.svg"; +import EyeOpen from "@/icons/eye-open.svg"; +import Flash from "@/icons/flash.svg"; +import Grid from "@/icons/grid.svg"; +import Info from "@/icons/info.svg"; +import List from "@/icons/list.svg"; +import Load from "@/icons/load.svg"; +import Paperclip from "@/icons/paperclip.svg"; +import Plus from "@/icons/plus.svg"; +import Reload from "@/icons/reload.svg"; +import Settings from "@/icons/settings.svg"; +import Trash from "@/icons/trash.svg"; +import Update from "@/icons/update.svg"; + +type IconVariant = + | "ArrowBottom" + | "ArrowLeft" + | "ArrowRight" + | "ArrowTop" + | "CaretDown" + | "CaretRight" + | "Checkmark" + | "ClanIcon" + | "ClanLogo" + | "Edit" + | "Expand" + | "EyeClose" + | "EyeOpen" + | "Flash" + | "Grid" + | "Info" + | "List" + | "Load" + | "Paperclip" + | "Plus" + | "Reload" + | "Settings" + | "Trash" + | "Update"; + +interface IconProps extends JSX.SvgSVGAttributes { + icon: IconVariant; +} + +const Icon: Component = (props) => { + const icons = { + ArrowBottom, + ArrowLeft, + ArrowRight, + ArrowTop, + CaretDown, + CaretRight, + Checkmark, + ClanIcon, + ClanLogo, + Edit, + Expand, + EyeClose, + EyeOpen, + Flash, + Grid, + Info, + List, + Load, + Paperclip, + Plus, + Reload, + Settings, + Trash, + Update, + }; + + const IconComponent = icons[props.icon]; + return IconComponent ? ( + + ) : null; +}; + +export default Icon; From ea98e6d190bfa36560a4c33fa3ade32765512d0f Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 26 Nov 2024 13:55:40 +0100 Subject: [PATCH 3/4] UI/button: make children optional, fix layout shift --- pkgs/webview-ui/app/src/components/button/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/webview-ui/app/src/components/button/index.tsx b/pkgs/webview-ui/app/src/components/button/index.tsx index 8502e2e2e..b9ae956ed 100644 --- a/pkgs/webview-ui/app/src/components/button/index.tsx +++ b/pkgs/webview-ui/app/src/components/button/index.tsx @@ -39,7 +39,7 @@ const sizePaddings: Record = { interface ButtonProps extends JSX.ButtonHTMLAttributes { variant?: Variants; size?: Size; - children: JSX.Element; + children?: JSX.Element; startIcon?: JSX.Element; endIcon?: JSX.Element; class?: string; @@ -67,9 +67,9 @@ export const Button = (props: ButtonProps) => { )} {...other} > - {local.startIcon} - {local.children} - {local.endIcon} + {local.startIcon && {local.startIcon}} + {local.children && {local.children}} + {local.endIcon && {local.endIcon}} ); }; From 5f306a7d757598b024b1b5c3e7989f1a9f6da629 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Tue, 26 Nov 2024 13:55:58 +0100 Subject: [PATCH 4/4] UI/backButton: use button and icon component --- pkgs/webview-ui/app/src/components/BackButton.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/webview-ui/app/src/components/BackButton.tsx b/pkgs/webview-ui/app/src/components/BackButton.tsx index e113739cb..97acfed46 100644 --- a/pkgs/webview-ui/app/src/components/BackButton.tsx +++ b/pkgs/webview-ui/app/src/components/BackButton.tsx @@ -1,10 +1,15 @@ import { useNavigate } from "@solidjs/router"; +import { Button } from "./button"; +import Icon from "./icon"; export const BackButton = () => { const navigate = useNavigate(); return ( - + ); };