diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1897dc9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: pnpm + + - run: pnpm install --frozen-lockfile + + - run: pnpm lint diff --git a/src/features/editor/AtlasFloat.tsx b/src/features/editor/AtlasFloat.tsx index 1fbd1f6..98cbdfd 100644 --- a/src/features/editor/AtlasFloat.tsx +++ b/src/features/editor/AtlasFloat.tsx @@ -35,6 +35,7 @@ export const AtlasFloat = ({ open, onClose }: Props): React.JSX.Element => { const atlasEfficiency = useStore((state) => state.atlasEfficiency); const setAtlasResult = useStore((state) => state.setAtlasResult); const exportSelection = useStore((state) => state.exportSelection); + const addToast = useStore((state) => state.addToast); const { packAtlas } = useAtlas(); @@ -67,7 +68,7 @@ export const AtlasFloat = ({ open, onClose }: Props): React.JSX.Element => { ); if (unpacked.length > 0) { - console.warn(`${unpacked.length} glyphs did not fit in atlas`); + addToast(`${unpacked.length} glyphs did not fit in atlas`, 'error'); } setAtlasResult(placements, imageData, packedWidth, packedHeight, efficiency); diff --git a/src/features/editor/glyph-list/GlyphList.tsx b/src/features/editor/glyph-list/GlyphList.tsx index 63e4bfd..d770a4f 100644 --- a/src/features/editor/glyph-list/GlyphList.tsx +++ b/src/features/editor/glyph-list/GlyphList.tsx @@ -395,7 +395,7 @@ export const GlyphList = ({ max={255} step={1} onValueChange={(value: number | readonly number[]) => { - const next = Array.isArray(value) ? value[0] : value; + const next = typeof value === 'number' ? value : value[0]; setGlyphAlphaThreshold(glyph, next); }} diff --git a/src/features/editor/toolbar/EditorToolbar.tsx b/src/features/editor/toolbar/EditorToolbar.tsx index 2589b82..cfd52bd 100644 --- a/src/features/editor/toolbar/EditorToolbar.tsx +++ b/src/features/editor/toolbar/EditorToolbar.tsx @@ -141,7 +141,7 @@ export const EditorToolbar = ({ return; } - const next = Array.isArray(value) ? value[0] : value; + const next = typeof value === 'number' ? value : value[0]; const settings = { ...currentProject.settings, alphaThreshold: next }; updateCurrentProject({ settings }); diff --git a/src/features/home/PaddingFields.tsx b/src/features/home/PaddingFields.tsx index 2463645..25575af 100644 --- a/src/features/home/PaddingFields.tsx +++ b/src/features/home/PaddingFields.tsx @@ -1,32 +1,8 @@ import React from 'react'; -import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; -const PaddingInput = ({ - label, - value, - onChange, -}: { - label: string; - value: number; - onChange: (value: number) => void; -}): React.JSX.Element => ( -
Extra space around each glyph.
Extra gap between glyphs in the atlas.