-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: misc component updates, styles, and gitignore #128
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,3 +38,6 @@ contracts/out/ | |
| /blob-report/ | ||
| /playwright/.cache/ | ||
| /playwright/.auth/ | ||
|
|
||
| *storybook.log | ||
| storybook-static | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,8 @@ import { SpinnerIcon } from '@phosphor-icons/react/dist/ssr'; | |||||||||
| import type { AccessKeyBucketScope, ListBucketsResponse } from '@filone/shared'; | ||||||||||
|
|
||||||||||
| import { apiRequest } from '../lib/api.js'; | ||||||||||
| import { Checkbox } from './Checkbox.js'; | ||||||||||
| import { Icon } from './Icon.js'; | ||||||||||
| import { Checkbox } from './Checkbox/index.js'; | ||||||||||
| import { Icon } from './Icon/index.js'; | ||||||||||
|
Comment on lines
+7
to
+8
|
||||||||||
| import { Checkbox } from './Checkbox/index.js'; | |
| import { Icon } from './Icon/index.js'; | |
| import { Checkbox } from './Checkbox'; | |
| import { Icon } from './Icon'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that all these components import from <Component>/index.js , but the actual extension file is index.ts. Also I don't think it's necessary to explicitly specify that import is coming from index.{ts|js} file.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Icon’s size prop is a number (defaults to 24). Passing size="md" will fail typechecking and may render incorrectly. Use a numeric size (e.g. 20) or extend Icon to support named sizes consistently.
| <Icon component={SpinnerIcon} size="md" /> | |
| <Icon component={SpinnerIcon} size={20} /> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| import type { AccessKeyPermission } from '@filone/shared'; | ||||||
| import { Checkbox } from './Checkbox'; | ||||||
| import { Checkbox } from './Checkbox/index.js'; | ||||||
|
||||||
| import { Checkbox } from './Checkbox/index.js'; | |
| import { Checkbox } from './Checkbox'; |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,69 +1,13 @@ | ||||||||
| import { useEffect, useRef, useState } from 'react'; | ||||||||
|
|
||||||||
| import { | ||||||||
| CopySimpleIcon, | ||||||||
| DotsThreeIcon, | ||||||||
| KeyIcon, | ||||||||
| PlusIcon, | ||||||||
| TrashIcon, | ||||||||
| } from '@phosphor-icons/react/dist/ssr'; | ||||||||
| import { DotsThreeIcon, KeyIcon, PlusIcon, TrashIcon } from '@phosphor-icons/react/dist/ssr'; | ||||||||
|
|
||||||||
| import type { AccessKey } from '@filone/shared'; | ||||||||
|
|
||||||||
| import { Badge } from './Badge/index.js'; | ||||||||
| import { Button } from './Button'; | ||||||||
| import { CopyButton } from './CopyButton'; | ||||||||
| import { formatDate } from '../lib/time.js'; | ||||||||
|
Comment on lines
+7
to
10
|
||||||||
| import { useCopyToClipboard } from '../lib/use-copy-to-clipboard.js'; | ||||||||
|
|
||||||||
| // --------------------------------------------------------------------------- | ||||||||
| // Sub-components | ||||||||
| // --------------------------------------------------------------------------- | ||||||||
|
|
||||||||
| function StatusBadge({ status }: { status: AccessKey['status'] }) { | ||||||||
| if (status === 'active') { | ||||||||
| return ( | ||||||||
| <span className="rounded-full border border-green-200 bg-green-50 px-2 py-0.5 text-xs font-medium text-green-700"> | ||||||||
| Active | ||||||||
| </span> | ||||||||
| ); | ||||||||
| } | ||||||||
| return ( | ||||||||
| <span className="rounded-full border border-zinc-200 bg-zinc-100 px-2 py-0.5 text-xs font-medium text-zinc-600"> | ||||||||
| Inactive | ||||||||
| </span> | ||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| function PermissionBadge({ permission }: { permission: string }) { | ||||||||
| return ( | ||||||||
| <span className="rounded-full border border-zinc-200 bg-zinc-100 px-2 py-0.5 text-[10px] font-medium uppercase text-zinc-600"> | ||||||||
| {permission} | ||||||||
| </span> | ||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| function BucketBadge({ name }: { name: string }) { | ||||||||
| return ( | ||||||||
| <span className="rounded-full bg-zinc-100 px-2.5 py-0.5 text-[10px] font-normal text-zinc-800"> | ||||||||
| {name} | ||||||||
| </span> | ||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| function CopyButton({ value }: { value: string }) { | ||||||||
| const { copied, copy } = useCopyToClipboard(); | ||||||||
|
|
||||||||
| return ( | ||||||||
| <button | ||||||||
| type="button" | ||||||||
| onClick={() => void copy(value)} | ||||||||
| title={copied ? 'Copied' : 'Copy'} | ||||||||
| aria-label={copied ? 'Copied to clipboard' : 'Copy to clipboard'} | ||||||||
| className="rounded p-0.5 text-zinc-400 hover:bg-zinc-100 hover:text-zinc-700" | ||||||||
| > | ||||||||
| <CopySimpleIcon size={12} /> | ||||||||
| </button> | ||||||||
| ); | ||||||||
| } | ||||||||
|
|
||||||||
| function ActionMenu({ onDelete }: { onDelete: () => void }) { | ||||||||
| const [open, setOpen] = useState(false); | ||||||||
|
|
@@ -159,7 +103,8 @@ export function AccessKeysTable({ | |||||||
| <p className="mb-1 text-sm font-medium text-zinc-900">{emptyTitle}</p> | ||||||||
| <p className="mb-4 text-sm text-zinc-500">{emptyDescription}</p> | ||||||||
| {onCreateOpen && ( | ||||||||
| <Button variant="filled" icon={PlusIcon} onClick={onCreateOpen}> | ||||||||
| <Button variant="default" onClick={onCreateOpen}> | ||||||||
| <PlusIcon className="size-4" /> | ||||||||
|
Comment on lines
+106
to
+107
|
||||||||
| <Button variant="default" onClick={onCreateOpen}> | |
| <PlusIcon className="size-4" /> | |
| <Button variant="primary" icon={PlusIcon} onClick={onCreateOpen}> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -7,9 +7,10 @@ import { expiresAtFromForm } from '../lib/time.js'; | |||||||||||||||
| import { AccessKeyExpirationFields } from './AccessKeyExpirationFields.js'; | ||||||||||||||||
| import type { ExpirationOption } from './AccessKeyExpirationFields.js'; | ||||||||||||||||
| import { AccessKeyPermissionsFields } from './AccessKeyPermissionsFields.js'; | ||||||||||||||||
| import { Button } from './Button.js'; | ||||||||||||||||
| import { Input } from './Input.js'; | ||||||||||||||||
| import { Modal, ModalBody, ModalFooter, ModalHeader } from './Modal/index.js'; | ||||||||||||||||
| import { Button } from './Button'; | ||||||||||||||||
| import { Input } from './Input/index.js'; | ||||||||||||||||
| import { Label } from './Label/index.js'; | ||||||||||||||||
| import { Dialog, DialogBody, DialogFooter, DialogHeader } from './Dialog'; | ||||||||||||||||
|
||||||||||||||||
| import { Dialog, DialogBody, DialogFooter, DialogHeader } from './Dialog'; | |
| import { | |
| Modal as Dialog, | |
| ModalBody as DialogBody, | |
| ModalFooter as DialogFooter, | |
| ModalHeader as DialogHeader, | |
| } from './Modal'; |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input’s onChange prop receives a string value (not a DOM event). Passing (e) => setKeyName(e.target.value) will throw at runtime/typecheck. Use onChange={setKeyName} (or onChange={(value) => setKeyName(value)}) with the existing Input component API.
| onChange={(e) => setKeyName(e.target.value)} | |
| onChange={setKeyName} |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button variants are limited to primary|ghost|tertiary|filled in this codebase; variant="default" will not compile. Use an existing variant (e.g. filled) or update Button.tsx to introduce default consistently.
| <Button variant="default" disabled={!canSubmit} onClick={handleCreate}> | |
| <Button variant="filled" disabled={!canSubmit} onClick={handleCreate}> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,44 @@ | ||
| import type { AnchorHTMLAttributes } from 'react'; | ||
| import { Component } from 'react'; | ||
| import type { AnchorHTMLAttributes, ReactNode } from 'react'; | ||
|
|
||
| import { Link } from '@tanstack/react-router'; | ||
|
|
||
| export type BaseLinkProps = { | ||
| href: string; | ||
| children?: React.ReactNode; | ||
| children?: ReactNode; | ||
| className?: string; | ||
| } & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'>; | ||
|
|
||
| function isInternalLink(href: string): boolean { | ||
| return href.startsWith('/') || href.startsWith('#'); | ||
| } | ||
|
|
||
| /** Falls back to a plain <a> if no router context is available (e.g. Storybook). */ | ||
| class RouterLinkSafe extends Component< | ||
| { to: string; children?: ReactNode } & Record<string, unknown>, | ||
| { hasError: boolean } | ||
|
Comment on lines
+17
to
+19
|
||
| > { | ||
| state = { hasError: false }; | ||
| static getDerivedStateFromError() { | ||
| return { hasError: true }; | ||
| } | ||
| render() { | ||
| const { to, children, ...rest } = this.props; | ||
| if (this.state.hasError) { | ||
| return ( | ||
| <a href={to} {...rest}> | ||
| {children} | ||
| </a> | ||
| ); | ||
| } | ||
| return ( | ||
| <Link to={to} {...rest}> | ||
| {children} | ||
| </Link> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export function BaseLink({ href, children, ...rest }: BaseLinkProps) { | ||
| if (href.startsWith('mailto:')) { | ||
| return ( | ||
|
|
@@ -23,9 +50,9 @@ export function BaseLink({ href, children, ...rest }: BaseLinkProps) { | |
|
|
||
| if (isInternalLink(href)) { | ||
| return ( | ||
| <Link to={href} {...rest}> | ||
| <RouterLinkSafe to={href} {...rest}> | ||
| {children} | ||
| </Link> | ||
| </RouterLinkSafe> | ||
| ); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,8 +11,8 @@ import { | |||||
| ChatCircleIcon, | ||||||
| } from '@phosphor-icons/react/dist/ssr'; | ||||||
| import { Link, useMatchRoute } from '@tanstack/react-router'; | ||||||
| import { ProgressBar } from './ProgressBar.js'; | ||||||
| import { Button } from './Button.js'; | ||||||
| import { ProgressBar } from './ProgressBar/index.js'; | ||||||
|
||||||
| import { ProgressBar } from './ProgressBar/index.js'; | |
| import { ProgressBar } from './ProgressBar'; |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button does not support variant="default" or the asChild prop (see components/Button.tsx, variants are primary|ghost|tertiary|filled). This usage won’t compile and also changes navigation behavior. Use href="/billing" with a supported variant (or extend Button to support asChild + the new variant everywhere).
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button does not support variant="default" or the asChild prop (variants are primary|ghost|tertiary|filled). This usage won’t compile; use href + a supported variant, or update Button to support these props consistently.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button does not support variant="default" or the asChild prop (variants are primary|ghost|tertiary|filled). This usage won’t compile; use href + a supported variant, or update Button to support these props consistently.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button does not support variant="default" or the asChild prop (variants are primary|ghost|tertiary|filled). This usage won’t compile; use href + a supported variant, or update Button to support these props consistently.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button does not support variant="default" or the asChild prop (variants are primary|ghost|tertiary|filled). This usage won’t compile; use href + a supported variant, or update Button to support these props consistently.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,9 +42,9 @@ export function useFileUpload({ bucketName, tags, onSuccess }: UseFileUploadOpti | |
| } | ||
| }, []); | ||
|
|
||
| const handleObjectNameChange = useCallback((value: string) => { | ||
| const handleObjectNameChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => { | ||
| userEditedName.current = true; | ||
| setObjectName(value); | ||
| setObjectName(e.target.value); | ||
| }, []); | ||
|
Comment on lines
+45
to
48
|
||
|
|
||
| const handleUpload = useCallback(async () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,2 +1,3 @@ | ||||
| @import 'tailwindcss'; | ||||
| @import '@fontsource-variable/inconsolata'; | ||||
|
||||
| @import '@fontsource-variable/inconsolata'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the
tsextension.