From 7450caf02ea9b97775d1ac826045074011037cc0 Mon Sep 17 00:00:00 2001 From: Arthur Green Date: Tue, 3 Sep 2024 22:21:47 +0400 Subject: [PATCH] fix: status view --- .gitattributes | 4 +- README.md | 4 +- package.json | 4 +- pnpm-lock.yaml | 251 ++++++++++++++++-------------- src/pages/posts/[postId]/edit.tsx | 33 ++-- 5 files changed, 165 insertions(+), 131 deletions(-) diff --git a/.gitattributes b/.gitattributes index b3bcf54e..2e130fc1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,7 @@ # Graphics *.jpg binary *.png binary +*.avif binary +*.webp binary *.gif binary *.ico binary - -package-lock.json merge=theirs diff --git a/README.md b/README.md index ae31d4cd..622a9568 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ # Local Microblogging Frontend Client -Micro blog app, using HTML / CSS / TS and React. The App allow you to view your news feed, add new posts and delete posts. Posts are stored locally, without using a back-end. The visual design is left to your discretion. -CRUD implemenation with React; +The App allows you to view your news feed, add new posts and delete posts. Posts are stored locally, without the use of back-end. The visual design is left to your discretion. TLDR: React CRUD; ## Tech Stack - React - TypeScript - daisyUI & TailwindCSS +- Dexie.js (indexedDB wrapper) - Storybook ## Contribution diff --git a/package.json b/package.json index d50a6aed..2ef256dd 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,8 @@ "@growthbook/growthbook-react": "^0.20.0", "@vanilla-extract/css": "^1.15.5", "daisyui": "^4.12.10", - "dexie": "^3.2.4", - "dexie-react-hooks": "^1.1.6", + "dexie": "^4.0.8", + "dexie-react-hooks": "^1.1.7", "react": "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.15.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7be42c42..8b44be6a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,11 +18,11 @@ importers: specifier: ^4.12.10 version: 4.12.10(postcss@8.4.41) dexie: - specifier: ^3.2.4 - version: 3.2.4 + specifier: ^4.0.8 + version: 4.0.8 dexie-react-hooks: - specifier: ^1.1.6 - version: 1.1.6(@types/react@18.3.4)(dexie@3.2.4)(react@18.3.1) + specifier: ^1.1.7 + version: 1.1.7(@types/react@18.3.4)(dexie@4.0.8)(react@18.3.1) react: specifier: ^18.3.1 version: 18.3.1 @@ -47,7 +47,7 @@ importers: version: 8.0.10(@types/react@18.3.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@storybook/addon-interactions': specifier: ^8.0.10 - version: 8.0.10(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + version: 8.0.10(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@storybook/addon-links': specifier: ^8.0.10 version: 8.0.10(react@18.3.1) @@ -65,7 +65,7 @@ importers: version: 8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.2.2) '@storybook/react-vite': specifier: ^8.0.10 - version: 8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@2.79.1)(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + version: 8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@2.79.1)(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@storybook/testing-library': specifier: ^0.2.2 version: 0.2.2 @@ -89,10 +89,10 @@ importers: version: 6.21.0(eslint@8.57.0)(typescript@5.2.2) '@vanilla-extract/vite-plugin': specifier: ^4.0.15 - version: 4.0.15(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + version: 4.0.15(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@vitejs/plugin-react-swc': specifier: ~3.7.0 - version: 3.7.0(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + version: 3.7.0(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) autoprefixer: specifier: ^10.4.13 version: 10.4.13(postcss@8.4.41) @@ -176,13 +176,13 @@ importers: version: 5.2.2 vite: specifier: ^5.4.2 - version: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + version: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) vite-plugin-pwa: specifier: ^0.20.1 - version: 0.20.1(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) + version: 0.20.1(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0) vitest: specifier: ^2.0.5 - version: 2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + version: 2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) packages: @@ -231,8 +231,8 @@ packages: resolution: {integrity: sha512-x32i4hEXvr+iI0NEoEfDKzlemF8AmtOP8CcrRaEcpzysWuoEb1KknpcvMsHKPONoKZiDuItklgWhB18xEhr9PA==} engines: {node: '>=6.9.0'} - '@babel/generator@7.25.5': - resolution: {integrity: sha512-abd43wyLfbWoxC6ahM8xTkqLpGB2iWBVyuKC9/srhFunCd1SDNrV1s72bBpK4hLj8KLzHBBcOblvLQZBNw9r3w==} + '@babel/generator@7.25.6': + resolution: {integrity: sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==} engines: {node: '>=6.9.0'} '@babel/helper-annotate-as-pure@7.22.5': @@ -437,8 +437,8 @@ packages: engines: {node: '>=6.0.0'} hasBin: true - '@babel/parser@7.25.4': - resolution: {integrity: sha512-nq+eWrOgdtu3jG5Os4TQP3x3cLA8hR8TvJNjD8vnPa20WGycimcparWnLK4jJhElTK6SDyuJo1weMKO/5LpmLA==} + '@babel/parser@7.25.6': + resolution: {integrity: sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==} engines: {node: '>=6.0.0'} hasBin: true @@ -540,8 +540,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-syntax-import-assertions@7.24.7': - resolution: {integrity: sha512-Ec3NRUMoi8gskrkBe3fNmEQfxDvY8bgfQpz6jlk/41kX9eUjvpyqWU7PBP/pLAvMaSQjbMNKJmvX57jP+M6bPg==} + '@babel/plugin-syntax-import-assertions@7.25.6': + resolution: {integrity: sha512-aABl0jHw9bZ2karQ/uUD6XP4u0SG22SJrOHFoL6XB1R7dTovOP4TzTlsxOYC5yQ1pdscVK2JTUnF6QL3ARoAiQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -552,8 +552,8 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 - '@babel/plugin-syntax-import-attributes@7.24.7': - resolution: {integrity: sha512-hbX+lKKeUMGihnK8nvKqmXBInriT3GVjzXKFriV3YC6APGxMbP8RZNFwy91+hocLXq90Mta+HshoB31802bb8A==} + '@babel/plugin-syntax-import-attributes@7.25.6': + resolution: {integrity: sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0-0 @@ -1272,6 +1272,10 @@ packages: resolution: {integrity: sha512-DSgLeL/FNcpXuzav5wfYvHCGvynXkJbn3Zvc3823AEe9nPwW9IK4UoCSS5yGymmQzN0pCPvivtgS6/8U2kkm1w==} engines: {node: '>=6.9.0'} + '@babel/runtime@7.25.6': + resolution: {integrity: sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==} + engines: {node: '>=6.9.0'} + '@babel/template@7.22.15': resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==} engines: {node: '>=6.9.0'} @@ -1288,8 +1292,8 @@ packages: resolution: {integrity: sha512-7aaBLeDQ4zYcUFDUD41lJc1fG8+5IU9DaNSJAgal866FGvmD5EbWQgnEC6kO1gGLsX0esNkfnJSndbTXA3r7UA==} engines: {node: '>=6.9.0'} - '@babel/traverse@7.25.4': - resolution: {integrity: sha512-VJ4XsrD+nOvlXyLzmLzUs/0qjFS4sK30te5yEFlvbbUNEgKaVb2BHZUpAL+ttLPQAHNrsI3zZisbfha5Cvr8vg==} + '@babel/traverse@7.25.6': + resolution: {integrity: sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==} engines: {node: '>=6.9.0'} '@babel/types@7.23.0': @@ -1300,8 +1304,8 @@ packages: resolution: {integrity: sha512-6mQNsaLeXTw0nxYUYu+NSa4Hx4BlF1x1x8/PMFbiR+GBSr+2DkECc69b8hgy2frEodNcvPffeH8YfWd3LI6jhQ==} engines: {node: '>=6.9.0'} - '@babel/types@7.25.4': - resolution: {integrity: sha512-zQ1ijeeCXVEh+aNL0RlmkPkG8HUiDcU2pzQQFjtbntgAczRASFzj4H+6+bV+dy1ntKR14I/DypeuRG1uma98iQ==} + '@babel/types@7.25.6': + resolution: {integrity: sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==} engines: {node: '>=6.9.0'} '@base2/pretty-print-object@1.0.1': @@ -2826,8 +2830,8 @@ packages: '@types/eslint-scope@3.7.7': resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} - '@types/eslint@9.6.0': - resolution: {integrity: sha512-gi6WQJ7cHRgZxtkQEoyHMppPjq9Kxo5Tjn2prSKDSmZrCz8TZ3jSRCeTJm+WoM+oB0WG37bRqLzaaU3q7JypGg==} + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} '@types/estree@0.0.39': resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} @@ -2910,6 +2914,9 @@ packages: '@types/node@22.5.0': resolution: {integrity: sha512-DkFrJOe+rfdHTqqMg0bSNlGlQ85hSoh2TPzZyhHsXnMtligRWpxUySiyw8FY14ITt24HVCiQPWxS3KO/QlGmWg==} + '@types/node@22.5.2': + resolution: {integrity: sha512-acJsPTEqYqulZS/Yp/S3GgeE6GZ0qYODUR8aVr/DkhHQ8l9nd4j5x1/ZJy9/gHrRlFMqkO6i0I3E27Alu4jjPg==} + '@types/normalize-package-data@2.4.4': resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -4079,16 +4086,15 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} - dexie-react-hooks@1.1.6: - resolution: {integrity: sha512-xSblWtmPwhafWNWMECsW7zMMmBu8goH3QqTxEfwBNoNG1mgsM0oFclippev7ss9HhKICqBwTjgqpscci5Ed4mA==} + dexie-react-hooks@1.1.7: + resolution: {integrity: sha512-Lwv5W0Hk+uOW3kGnsU9GZoR1er1B7WQ5DSdonoNG+focTNeJbHW6vi6nBoX534VKI3/uwHebYzSw1fwY6a7mTw==} peerDependencies: '@types/react': '>=16' dexie: ^3.2 || ^4.0.1-alpha react: '>=16' - dexie@3.2.4: - resolution: {integrity: sha512-VKoTQRSv7+RnffpOJ3Dh6ozknBqzWw/F3iqMdsZg958R0AS8AnY9x9d1lbwENr0gzeGJHXKcGhAMRaqys6SxqA==} - engines: {node: '>=6.0'} + dexie@4.0.8: + resolution: {integrity: sha512-1G6cJevS17KMDK847V3OHvK2zei899GwpDiqfEXHP1ASvme6eWJmAp9AU4s1son2TeGkWmC0g3y8ezOBPnalgQ==} didyoumean@1.2.2: resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} @@ -4753,8 +4759,8 @@ packages: resolution: {integrity: sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==} engines: {node: '>= 0.4'} - get-tsconfig@4.7.6: - resolution: {integrity: sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==} + get-tsconfig@4.8.0: + resolution: {integrity: sha512-Pgba6TExTZ0FJAn1qkJAjIeKoDJ3CsI2ChuLohJnZl/tTU8MVrq3b+2t5UOPfRa4RMsorClBjJALkJUMjG1PAw==} giget@1.2.3: resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==} @@ -6164,6 +6170,9 @@ packages: picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} + picocolors@1.1.0: + resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} @@ -7950,7 +7959,7 @@ snapshots: '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/compat-data@7.24.4': {} @@ -7983,9 +7992,9 @@ snapshots: '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 - '@babel/generator@7.25.5': + '@babel/generator@7.25.6': dependencies: - '@babel/types': 7.25.4 + '@babel/types': 7.25.6 '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 jsesc: 2.5.2 @@ -7996,7 +8005,7 @@ snapshots: '@babel/helper-annotate-as-pure@7.24.7': dependencies: - '@babel/types': 7.25.4 + '@babel/types': 7.25.6 '@babel/helper-builder-binary-assignment-operator-visitor@7.22.15': dependencies: @@ -8004,8 +8013,8 @@ snapshots: '@babel/helper-builder-binary-assignment-operator-visitor@7.24.7': dependencies: - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8046,7 +8055,7 @@ snapshots: '@babel/helper-optimise-call-expression': 7.24.7 '@babel/helper-replace-supers': 7.25.0(@babel/core@7.24.5) '@babel/helper-skip-transparent-expression-wrappers': 7.24.7 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -8093,8 +8102,8 @@ snapshots: '@babel/helper-member-expression-to-functions@7.24.8': dependencies: - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8104,8 +8113,8 @@ snapshots: '@babel/helper-module-imports@7.24.7': dependencies: - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8124,7 +8133,7 @@ snapshots: '@babel/helper-module-imports': 7.24.7 '@babel/helper-simple-access': 7.24.7 '@babel/helper-validator-identifier': 7.24.7 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8134,7 +8143,7 @@ snapshots: '@babel/helper-optimise-call-expression@7.24.7': dependencies: - '@babel/types': 7.25.4 + '@babel/types': 7.25.6 '@babel/helper-plugin-utils@7.24.5': {} @@ -8152,7 +8161,7 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-annotate-as-pure': 7.24.7 '@babel/helper-wrap-function': 7.25.0 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8168,7 +8177,7 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-member-expression-to-functions': 7.24.8 '@babel/helper-optimise-call-expression': 7.24.7 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8178,8 +8187,8 @@ snapshots: '@babel/helper-simple-access@7.24.7': dependencies: - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8189,8 +8198,8 @@ snapshots: '@babel/helper-skip-transparent-expression-wrappers@7.24.7': dependencies: - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8219,8 +8228,8 @@ snapshots: '@babel/helper-wrap-function@7.25.0': dependencies: '@babel/template': 7.25.0 - '@babel/traverse': 7.25.4 - '@babel/types': 7.25.4 + '@babel/traverse': 7.25.6 + '@babel/types': 7.25.6 transitivePeerDependencies: - supports-color @@ -8244,15 +8253,15 @@ snapshots: '@babel/helper-validator-identifier': 7.24.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.0.1 + picocolors: 1.1.0 '@babel/parser@7.24.5': dependencies: '@babel/types': 7.24.5 - '@babel/parser@7.25.4': + '@babel/parser@7.25.6': dependencies: - '@babel/types': 7.25.4 + '@babel/types': 7.25.6 '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.24.5(@babel/core@7.24.5)': dependencies: @@ -8264,7 +8273,7 @@ snapshots: dependencies: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8309,7 +8318,7 @@ snapshots: dependencies: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8352,7 +8361,7 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.5 - '@babel/plugin-syntax-import-assertions@7.24.7(@babel/core@7.24.5)': + '@babel/plugin-syntax-import-assertions@7.25.6(@babel/core@7.24.5)': dependencies: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.8 @@ -8362,7 +8371,7 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.5 - '@babel/plugin-syntax-import-attributes@7.24.7(@babel/core@7.24.5)': + '@babel/plugin-syntax-import-attributes@7.25.6(@babel/core@7.24.5)': dependencies: '@babel/core': 7.24.5 '@babel/helper-plugin-utils': 7.24.8 @@ -8457,7 +8466,7 @@ snapshots: '@babel/helper-plugin-utils': 7.24.8 '@babel/helper-remap-async-to-generator': 7.25.0(@babel/core@7.24.5) '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.24.5) - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8546,7 +8555,7 @@ snapshots: '@babel/helper-compilation-targets': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 '@babel/helper-replace-supers': 7.25.0(@babel/core@7.24.5) - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -8671,7 +8680,7 @@ snapshots: '@babel/core': 7.24.5 '@babel/helper-compilation-targets': 7.25.2 '@babel/helper-plugin-utils': 7.24.8 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -8763,7 +8772,7 @@ snapshots: '@babel/helper-module-transforms': 7.25.2(@babel/core@7.24.5) '@babel/helper-plugin-utils': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 - '@babel/traverse': 7.25.4 + '@babel/traverse': 7.25.6 transitivePeerDependencies: - supports-color @@ -9172,8 +9181,8 @@ snapshots: '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.24.5) '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.5) '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.5) - '@babel/plugin-syntax-import-assertions': 7.24.7(@babel/core@7.24.5) - '@babel/plugin-syntax-import-attributes': 7.24.7(@babel/core@7.24.5) + '@babel/plugin-syntax-import-assertions': 7.25.6(@babel/core@7.24.5) + '@babel/plugin-syntax-import-attributes': 7.25.6(@babel/core@7.24.5) '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.24.5) '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.5) '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.5) @@ -9289,6 +9298,10 @@ snapshots: dependencies: regenerator-runtime: 0.14.1 + '@babel/runtime@7.25.6': + dependencies: + regenerator-runtime: 0.14.1 + '@babel/template@7.22.15': dependencies: '@babel/code-frame': 7.24.2 @@ -9304,8 +9317,8 @@ snapshots: '@babel/template@7.25.0': dependencies: '@babel/code-frame': 7.24.7 - '@babel/parser': 7.25.4 - '@babel/types': 7.25.4 + '@babel/parser': 7.25.6 + '@babel/types': 7.25.6 '@babel/traverse@7.24.5': dependencies: @@ -9322,13 +9335,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@babel/traverse@7.25.4': + '@babel/traverse@7.25.6': dependencies: '@babel/code-frame': 7.24.7 - '@babel/generator': 7.25.5 - '@babel/parser': 7.25.4 + '@babel/generator': 7.25.6 + '@babel/parser': 7.25.6 '@babel/template': 7.25.0 - '@babel/types': 7.25.4 + '@babel/types': 7.25.6 debug: 4.3.6 globals: 11.12.0 transitivePeerDependencies: @@ -9346,7 +9359,7 @@ snapshots: '@babel/helper-validator-identifier': 7.24.5 to-fast-properties: 2.0.0 - '@babel/types@7.25.4': + '@babel/types@7.25.6': dependencies: '@babel/helper-string-parser': 7.24.8 '@babel/helper-validator-identifier': 7.24.7 @@ -9657,13 +9670,13 @@ snapshots: dependencies: '@sinclair/typebox': 0.27.8 - '@joshwooding/vite-plugin-react-docgen-typescript@0.3.0(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@joshwooding/vite-plugin-react-docgen-typescript@0.3.0(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: glob: 7.2.3 glob-promise: 4.2.2(glob@7.2.3) magic-string: 0.27.0 react-docgen-typescript: 2.2.2(typescript@5.2.2) - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) optionalDependencies: typescript: 5.2.2 @@ -10239,11 +10252,11 @@ snapshots: dependencies: '@storybook/global': 5.0.0 - '@storybook/addon-interactions@8.0.10(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@storybook/addon-interactions@8.0.10(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: '@storybook/global': 5.0.0 '@storybook/instrumenter': 8.0.10 - '@storybook/test': 8.0.10(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + '@storybook/test': 8.0.10(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@storybook/types': 8.0.10 polished: 4.3.1 ts-dedent: 2.2.0 @@ -10384,7 +10397,7 @@ snapshots: - encoding - supports-color - '@storybook/builder-vite@8.0.10(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@storybook/builder-vite@8.0.10(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: '@storybook/channels': 8.0.10 '@storybook/client-logger': 8.0.10 @@ -10403,7 +10416,7 @@ snapshots: fs-extra: 11.2.0 magic-string: 0.30.10 ts-dedent: 2.2.0 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) optionalDependencies: typescript: 5.2.2 transitivePeerDependencies: @@ -10838,11 +10851,11 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - '@storybook/react-vite@8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@2.79.1)(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@storybook/react-vite@8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rollup@2.79.1)(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: - '@joshwooding/vite-plugin-react-docgen-typescript': 0.3.0(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + '@joshwooding/vite-plugin-react-docgen-typescript': 0.3.0(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@rollup/pluginutils': 5.1.0(rollup@2.79.1) - '@storybook/builder-vite': 8.0.10(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + '@storybook/builder-vite': 8.0.10(typescript@5.2.2)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@storybook/node-logger': 8.0.10 '@storybook/react': 8.0.10(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.2.2) find-up: 5.0.0 @@ -10852,7 +10865,7 @@ snapshots: react-dom: 18.3.1(react@18.3.1) resolve: 1.22.8 tsconfig-paths: 4.2.0 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@preact/preset-vite' - encoding @@ -10928,14 +10941,14 @@ snapshots: - encoding - supports-color - '@storybook/test@8.0.10(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@storybook/test@8.0.10(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: '@storybook/client-logger': 8.0.10 '@storybook/core-events': 8.0.10 '@storybook/instrumenter': 8.0.10 '@storybook/preview-api': 8.0.10 '@testing-library/dom': 9.3.4 - '@testing-library/jest-dom': 6.4.5(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) + '@testing-library/jest-dom': 6.4.5(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)) '@testing-library/user-event': 14.5.2(@testing-library/dom@9.3.4) '@vitest/expect': 1.3.1 '@vitest/spy': 1.6.0 @@ -11090,7 +11103,7 @@ snapshots: lz-string: 1.5.0 pretty-format: 27.5.1 - '@testing-library/jest-dom@6.4.5(vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@testing-library/jest-dom@6.4.5(vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: '@adobe/css-tools': 4.3.3 '@babel/runtime': 7.24.5 @@ -11101,7 +11114,7 @@ snapshots: lodash: 4.17.21 redent: 3.0.0 optionalDependencies: - vitest: 2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vitest: 2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) '@testing-library/user-event@14.4.3(@testing-library/dom@9.3.1)': dependencies: @@ -11177,10 +11190,10 @@ snapshots: '@types/eslint-scope@3.7.7': dependencies: - '@types/eslint': 9.6.0 + '@types/eslint': 9.6.1 '@types/estree': 1.0.5 - '@types/eslint@9.6.0': + '@types/eslint@9.6.1': dependencies: '@types/estree': 1.0.5 '@types/json-schema': 7.0.15 @@ -11270,6 +11283,10 @@ snapshots: dependencies: undici-types: 6.19.8 + '@types/node@22.5.2': + dependencies: + undici-types: 6.19.8 + '@types/normalize-package-data@2.4.4': {} '@types/pretty-hrtime@1.0.2': {} @@ -11476,7 +11493,7 @@ snapshots: transitivePeerDependencies: - babel-plugin-macros - '@vanilla-extract/integration@7.1.9(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)': + '@vanilla-extract/integration@7.1.9(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)': dependencies: '@babel/core': 7.24.5 '@babel/plugin-syntax-typescript': 7.24.1(@babel/core@7.24.5) @@ -11488,8 +11505,8 @@ snapshots: find-up: 5.0.0 javascript-stringify: 2.1.0 mlly: 1.7.1 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) - vite-node: 1.6.0(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite-node: 1.6.0(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -11504,10 +11521,10 @@ snapshots: '@vanilla-extract/private@1.0.6': {} - '@vanilla-extract/vite-plugin@4.0.15(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@vanilla-extract/vite-plugin@4.0.15(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6)(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: - '@vanilla-extract/integration': 7.1.9(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + '@vanilla-extract/integration': 7.1.9(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@types/node' - babel-plugin-macros @@ -11520,10 +11537,10 @@ snapshots: - supports-color - terser - '@vitejs/plugin-react-swc@3.7.0(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': + '@vitejs/plugin-react-swc@3.7.0(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))': dependencies: '@swc/core': 1.7.18 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@swc/helpers' @@ -12696,13 +12713,13 @@ snapshots: dependencies: dequal: 2.0.3 - dexie-react-hooks@1.1.6(@types/react@18.3.4)(dexie@3.2.4)(react@18.3.1): + dexie-react-hooks@1.1.7(@types/react@18.3.4)(dexie@4.0.8)(react@18.3.1): dependencies: '@types/react': 18.3.4 - dexie: 3.2.4 + dexie: 4.0.8 react: 18.3.1 - dexie@3.2.4: {} + dexie@4.0.8: {} didyoumean@1.2.2: {} @@ -13237,7 +13254,7 @@ snapshots: builtins: 5.1.0 eslint: 8.57.0 eslint-plugin-es-x: 7.8.0(eslint@8.57.0) - get-tsconfig: 4.7.6 + get-tsconfig: 4.8.0 globals: 13.24.0 ignore: 5.3.2 is-builtin-module: 3.2.1 @@ -13686,7 +13703,7 @@ snapshots: es-errors: 1.3.0 get-intrinsic: 1.2.4 - get-tsconfig@4.7.6: + get-tsconfig@4.8.0: dependencies: resolve-pkg-maps: 1.0.0 @@ -14167,7 +14184,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 22.5.0 + '@types/node': 22.5.2 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -15225,6 +15242,8 @@ snapshots: picocolors@1.0.1: {} + picocolors@1.1.0: {} + picomatch@2.3.1: {} picomatch@4.0.2: {} @@ -16767,13 +16786,13 @@ snapshots: unist-util-stringify-position: 4.0.0 vfile-message: 4.0.2 - vite-node@1.6.0(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): + vite-node@1.6.0(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): dependencies: cac: 6.7.14 debug: 4.3.6 pathe: 1.1.2 picocolors: 1.0.1 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@types/node' - less @@ -16785,13 +16804,13 @@ snapshots: - supports-color - terser - vite-node@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): + vite-node@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): dependencies: cac: 6.7.14 debug: 4.3.6 pathe: 1.1.2 tinyrainbow: 1.2.0 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) transitivePeerDependencies: - '@types/node' - less @@ -16803,30 +16822,30 @@ snapshots: - supports-color - terser - vite-plugin-pwa@0.20.1(vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0): + vite-plugin-pwa@0.20.1(vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6))(workbox-build@7.1.0(@types/babel__core@7.20.5))(workbox-window@7.1.0): dependencies: debug: 4.3.6 pretty-bytes: 6.1.1 tinyglobby: 0.2.0 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) workbox-build: 7.1.0(@types/babel__core@7.20.5) workbox-window: 7.1.0 transitivePeerDependencies: - supports-color - vite@5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): + vite@5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): dependencies: esbuild: 0.21.5 postcss: 8.4.41 rollup: 4.21.0 optionalDependencies: - '@types/node': 22.5.0 + '@types/node': 22.5.2 fsevents: 2.3.3 less: 4.2.0 lightningcss: 1.22.0 terser: 5.31.6 - vitest@2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): + vitest@2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6): dependencies: '@ampproject/remapping': 2.3.0 '@vitest/expect': 2.0.5 @@ -16844,11 +16863,11 @@ snapshots: tinybench: 2.9.0 tinypool: 1.0.0 tinyrainbow: 1.2.0 - vite: 5.4.2(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) - vite-node: 2.0.5(@types/node@22.5.0)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite: 5.4.2(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) + vite-node: 2.0.5(@types/node@22.5.2)(less@4.2.0)(lightningcss@1.22.0)(terser@5.31.6) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.5.0 + '@types/node': 22.5.2 transitivePeerDependencies: - less - lightningcss @@ -16994,7 +17013,7 @@ snapshots: '@apideck/better-ajv-errors': 0.3.6(ajv@8.17.1) '@babel/core': 7.24.5 '@babel/preset-env': 7.25.4(@babel/core@7.24.5) - '@babel/runtime': 7.25.4 + '@babel/runtime': 7.25.6 '@rollup/plugin-babel': 5.3.1(@babel/core@7.24.5)(@types/babel__core@7.20.5)(rollup@2.79.1) '@rollup/plugin-node-resolve': 15.2.3(rollup@2.79.1) '@rollup/plugin-replace': 2.4.2(rollup@2.79.1) diff --git a/src/pages/posts/[postId]/edit.tsx b/src/pages/posts/[postId]/edit.tsx index b822c222..bda7b02e 100644 --- a/src/pages/posts/[postId]/edit.tsx +++ b/src/pages/posts/[postId]/edit.tsx @@ -3,19 +3,22 @@ import { useState } from 'react'; import { redirect, useParams } from 'react-router-dom'; import { useLiveQuery } from 'dexie-react-hooks'; -import { Input } from '~/components/input'; import { db } from '~/services/db'; import type { IBlogPost } from '~/components/post-preview'; interface IBlogPostProps { post: IBlogPost; } +interface IStatus { + status: 'success' | 'info' | 'error'; + message: string; +} export function EditPost({ post }: IBlogPostProps) { const [heading, setHeading] = useState(post.heading); const [text, setText] = useState(post.text); const [img, setImg] = useState(post.img); - const [status, setStatus] = useState(''); + const [status, setStatus] = useState(null); const [hashtags, setHashtags] = useState(''); const { postId } = useParams(); @@ -48,16 +51,23 @@ export function EditPost({ post }: IBlogPostProps) { }) .then((updated) => { if (updated) { - setStatus( - `Post "${heading}" successfully updated. Post id ${postId}`, - ); + setStatus({ + status: 'success', + message: `Post "${heading}" successfully updated. Post id ${postId}`, + }); redirect('/'); } else { - setStatus(`Nothing happend with ${postId}`); + setStatus({ + status: 'info', + message: `Nothing happend with ${postId}`, + }); } }); } catch (error) { - setStatus(`Failed to update ${heading}: ${error}`); + setStatus({ + status: 'error', + message: `Failed to update ${heading}: ${error}`, + }); } } @@ -69,8 +79,12 @@ export function EditPost({ post }: IBlogPostProps) { return (
- {status &&

{status}

}
+ {status && ( +
+ {status.message} +
+ )}

Any updates?

{img && (
@@ -84,9 +98,10 @@ export function EditPost({ post }: IBlogPostProps) { )}
- { setHeading(e.target.value); }}