Commit 2221e36
refactor: modify codebase to
### Description
<!-- Please add PR description (don't leave blank) - example: This PR
[adds/removes/fixes/replaces] the [feature/bug/etc] -->
This Pull Request refactors the codebase to meet the new requirement of
`astro@v5` following the upgrade in
#147; It introduces
several changes to improve the handling of word slugs across the
codebase, streamline content collection definitions, and enhance utility
functions. The most significant updates include replacing hardcoded
slugs with dynamically generated slugs, refactoring content collection
logic, and introducing new utility functions for building word slugs.
#### Word Slug Improvements:
*
[`src/components/islands/search.jsx`](diffhunk://#diff-9b7b1c6e6107530c0f69ea6f9a66511c9dab654d0eff83736b92475dba39858aL30-R31):
Updated the `slug` property to use the new `buildWordSlug` utility
function instead of hardcoding values. This change improves flexibility
and consistency in slug generation.
* `src/pages/browse/[alpha]/[page].astro`: Replaced hardcoded slugs with
dynamically generated slugs using the `buildWordSlug` utility function
in the word list rendering logic.
([src/pages/browse/[alpha]/[page].astroL46-R47](diffhunk://#diff-c87fe48708b5daee9f4aa138cb2970623ed74a334fa0912fef67f3a71905ee39L46-R47))
* `src/pages/browse/[...slug].astro`: Refactored the `getStaticPaths`
function to use `word.id` instead of `word.slug`, ensuring alignment
with the new slug generation approach.
([src/pages/browse/[...slug].astroL2-R19](diffhunk://#diff-5b7720b6f66d6cb09271ebf726a219ddf89ea09f9e3e4cb1e27c4088e8dd6796L2-R19))
#### Content Collection Refactoring:
*
[`src/content.config.ts`](diffhunk://#diff-0d78708eb6a4cf32e1758b9f04d0f05b751a26662664493a7c066252a0012f35R1-R8):
Introduced a new `dictionary` collection definition using
`astro:content` to simplify and centralize content loading.
#### Utility Enhancements:
*
[`src/lib/utils/index.js`](diffhunk://#diff-15cd75e36ffbf7470b9767c164c4cbc65fb58d685753f23441ee7b050998193eR81-R89):
Added the `buildWordSlug` utility function to dynamically generate slugs
based on word IDs, improving maintainability and reducing duplication.
#### Dependency and Import Updates:
*
[`astro.config.mjs`](diffhunk://#diff-e0f0c5adbe0b9ca5d0b57caf5cea33a8d88899fd02a43df1e9862b185f8a1e5fR4-L6):
Updated the `vercel` integration to use the default export from
`@astrojs/vercel` instead of the `serverless` variant.
*
[`src/lib/actions/do-edit-word.js`](diffhunk://#diff-b56e8ad6eb2e7f82bcca6ecffe96fce797e5bd64259ffbf637712d46994260a4R2):
Added the `decrypt` utility to the imports, potentially for future use
in word editing functionality.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>astro@v5 (#151)1 parent defdfc2 commit 2221e36
7 files changed
Lines changed: 49 additions & 17 deletions
File tree
- src
- components/islands
- lib
- actions
- utils
- pages/browse
- [alpha]
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | | - | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
80 | 98 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 2 | + | |
| 3 | + | |
8 | 4 | | |
9 | 5 | | |
10 | 6 | | |
11 | 7 | | |
12 | 8 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
16 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
0 commit comments