diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..e0fdd24 --- /dev/null +++ b/.env.example @@ -0,0 +1,5 @@ +VITE_PAYMENTS_API_URL= +VITE_DRIVE_API_URL= +VITE_MAGIC_IV= +VITE_MAGIC_SALT= +VITE_CRYPTO_SECRET= \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3e289ad --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: Mail Web CI + +on: + pull_request: + branches: [master] + +jobs: + ci: + runs-on: ubuntu-22.04 + + strategy: + matrix: + node-version: [24.x] + + env: + VITE_PAYMENTS_API_URL: ${{ secrets.PAYMENTS_API_URL }} + VITE_DRIVE_API_URL: ${{ secrets.DRIVE_API_URL }} + VITE_MAGIC_IV: ${{ secrets.MAGIC_IV }} + VITE_MAGIC_SALT: ${{ secrets.MAGIC_SALT }} + VITE_CRYPTO_SECRET: ${{ secrets.CRYPTO_SECRET }} + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + + - run: yarn install --frozen-lockfile + - run: yarn build + - run: yarn test diff --git a/package.json b/package.json index 28d1e11..010b98c 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,21 @@ "private": true, "version": "0.0.0", "type": "module", + "engines": { + "node": ">=24" + }, "scripts": { "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", - "preview": "vite preview" + "preview": "vite preview", + "test": "vitest run", + "test:ui": "vitest --ui", + "test:coverage": "vitest run --coverage" }, "dependencies": { "@internxt/css-config": "^1.1.0", + "@internxt/sdk": "^1.15.1", "@internxt/ui": "^0.1.9", "@phosphor-icons/react": "^2.1.10", "@tailwindcss/vite": "^4.2.1", @@ -41,9 +48,11 @@ "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", "globals": "^16.5.0", + "jsdom": "^28.1.0", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", "vite": "^7.3.1", - "vite-plugin-node-polyfills": "^0.25.0" + "vite-plugin-node-polyfills": "^0.25.0", + "vitest": "^4.0.18" } } diff --git a/src/components/chips/RecipientChip.tsx b/src/components/chips/RecipientChip.tsx index 8893f54..c666c39 100644 --- a/src/components/chips/RecipientChip.tsx +++ b/src/components/chips/RecipientChip.tsx @@ -1,5 +1,5 @@ import { XIcon } from '@phosphor-icons/react' -import type { Recipient } from '../composeMessageDialog/types' +import type { Recipient } from '../mail/composeMessageDialog/types' interface RecipientChipProps { recipient: Recipient diff --git a/src/components/mail/composeMessageDialog/components/RecipientInput.tsx b/src/components/mail/composeMessageDialog/components/RecipientInput.tsx index f0e3fcb..b1c35ea 100644 --- a/src/components/mail/composeMessageDialog/components/RecipientInput.tsx +++ b/src/components/mail/composeMessageDialog/components/RecipientInput.tsx @@ -1,6 +1,6 @@ import { useState, type KeyboardEvent } from 'react' import type { Recipient } from '../types' -import { RecipientChip } from '../../chips/RecipientChip' +import { RecipientChip } from '@/components/chips/RecipientChip' interface RecipientInputProps { label: string @@ -46,7 +46,7 @@ export const RecipientInput = ({ inputValue === '' && recipients.length > 0 ) { - onRemoveRecipient(recipients[recipients.length - 1].id) + onRemoveRecipient(recipients.at(-1)!.id) } } @@ -60,9 +60,7 @@ export const RecipientInput = ({ return (
- {label} -
+{label}