aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages
Commit message (Collapse)AuthorAgeFilesLines
* fix(styles): increase CSS specifity for some selectorsArmand Philippot2023-12-202-39/+41
| | | | | | | | | | | Since `sideEffects` has been added to activate tree shakings, the styles are imported in the wrong order in production build. There is an open issue (again) on Next.js repo. I'm not sure it will be fixed soon so in the meantime I had to increase the specifity of some selectors to avoid broken styles. I also fixed two minor layout errors: * CV page widgets should use headings of level 2 * Homepage should wrap the cards in list items
* fix(layout): refine pagination when JS is disabledArmand Philippot2023-12-192-35/+19
| | | | | | | | * fix the total number of pages * hide the load more button and the progress bar * remove the informative notice since it is no longer necessary * if the page number is equal to 1, use Blog route directly (NextJS is not able to redirect the user when JS is disabled)
* refactor(pages): merge Github/Gitlab overview on project pagesArmand Philippot2023-12-181-135/+104
| | | | | | By using conditional fetchning we can avoid to duplicate the ProjectOverview component and be more accurate about what data is loading.
* fix(pages): use dynamic imports for the table of contentsArmand Philippot2023-12-186-16/+55
| | | | | | | The ToCWidget relies on Javascript to display the headings. If JS is disabled in the browser, the widget is empty. For a better UX, we should use dynamic imports. Now, the ToC is only displayed when JS is enabled.
* fix(pages): add default settings to html tagArmand Philippot2023-12-181-1/+7
| | | | | | | When building the website, some styles are missing if JS is disabled in the browser because we rely on Javascript to set the current theme. By providing some default settings, the JS-free version can access those styles.
* fix(build): handle Next.js errors and warnings during buildArmand Philippot2023-12-163-23/+41
| | | | | | | | | | | | * extract Blog component from BlogPage (paginated) and extract Article component from ArticlePage to avoid `Cannot read properties` errors due to fallback route * fix sitemap build (cjs not supported) * fix eslint warnings (react/jsx-no-literals) * update `start` script since I'm using standalone output * update `postbuild` script since we need to copy public and static files to standalone directory (Next.js does not handle it itself because we should use a CDN...)
* refactor(pages): rewrite helpers to output schema in json-ld formatArmand Philippot2023-12-1413-383/+309
| | | | | | | | | | | | | * make sure url are absolutes * nest breadcrumb schema in webpage schema * trim HTML tags from content/description * use a regular script instead of next/script (with the latter the schema is not updated on route change) * place the script in document head * add keywords, wordCount and readingTime keys in BlogPosting schema * fix breadcrumbs in search page (without query) * add tests (a `MatchInlineSnapshot` will be better but Prettier 3 is not supported yet)
* refactor(hooks): rewrite useBreadcrumbs hookArmand Philippot2023-12-1213-156/+106
| | | | | | | * use next/router to get the slug instead of using props * handle cases where the current page title is not provided * update JSON-LD schema to match the example in documentation * add tests
* refactor(pages): refine Contact pageArmand Philippot2023-12-111-46/+42
| | | | | | | * remove next/router dependency * remove pageTitle since it is defined in MDX * reduce statements by grouping messages * mock response with MSW and add test for sendEmail
* refactor(pages): refine LegalNotice pageArmand Philippot2023-12-091-8/+6
| | | | | | * remove unnecessary dependency (useRouter) * fix React errors (blurWidth/blurHeight) * complete Cypress tests
* refactor(pages): refine 404 pageArmand Philippot2023-12-091-77/+117
| | | | | * refresh topics and thematics list using hooks * add Cypress tests
* refactor(pages): refine Project pagesArmand Philippot2023-12-086-129/+237
| | | | | | | | | | | * refactor ProjectOverview component to let consumers handle the value * extract project overview depending on Github to avoid fetching Github API if the project is not on Github * wrap dynamic import in a useMemo hook to avoid infinite rerender * fix table of contents by adding a useMutationObserver hook to refresh headings tree (without it useHeadingsTree is not retriggered once the dynamic import is done) * add Cypress tests
* refactor(hooks): replace useGithubApi with useGithubRepoMetaArmand Philippot2023-12-071-18/+17
| | | | | | | | * use GraphQL API instead of REST (the inconvenient however is that we now need an authorization token...) * move fetcher in services * add tests * mock response using MSW
* refactor(pages): refine Projects pageArmand Philippot2023-12-072-62/+91
| | | | | | | * add a `contexts` meta key to projects * replace `technologies` with `contexts` key in projects list * make getProjectsFilenames async * add Cypress tests
* refactor(pages): refine Search pageArmand Philippot2023-12-071-154/+211
| | | | | | | * extract NoResults component to improve readability * provide a different message when the url does not contain a query * use hooks to refresh Thematics and Topics lists * remove useDataFromApi hook
* refactor(pages): refine Blog pagesArmand Philippot2023-12-043-251/+398
| | | | | | | | | | * replace usePostsList with useArticlesList to keep names coherent * remove useIsMounted hook * rewrite useRedirection hook * add redirect in getStaticProps to avoid unecessary fetching * move Pagination component in a noscript tag * use hooks to refresh thematics and topics lists * complete Cypress tests
* refactor(pages): refine Topic pagesArmand Philippot2023-12-011-72/+130
| | | | | | * add useTopic and useTopicsList hooks to refresh data * add a table of contents * add Cypress tests
* refactor(pages): refine Thematic pagesArmand Philippot2023-12-012-63/+120
| | | | | | | | | | | * add a table of contents (however posts heading are not included) * rename posts list section title * add a useThematic hook to refresh thematic contents * add a useThematicLists hook to refresh thematics list * add a `notIn` filter in thematics list fetcher to directly remove unwanted thematics * add Cypress tests
* refactor(pages): refine Article pagesArmand Philippot2023-12-012-133/+98
| | | | | | | | | | | * use rehype to update code blocks class names * fix widget heading level (after a level 1 it should always be a level 2 and not 3) * replace Spinner with LoadingPage and LoadingPageComments components to keep layout coherent * refactor useArticle and useComments hooks * fix URLs in JSON LD schema * add Cypress tests
* refactor(pages): refine RSS feedArmand Philippot2023-11-306-72/+66
| | | | | | | | | | | * add favicon * add item categories * add item image * add item author * add item update date (it seems `date` is used as update date by Feed) * change copyright format * fix ESlint errors * fix atom and json links
* refactor(pages): refine CV pageArmand Philippot2023-11-291-62/+62
| | | | | | * reduce the number of statements by grouping the messages * remove LinkedIn from the widget (it is obviously not a repo and my CV is already here, no need to link to an external site)
* refactor(pages): improve HomepageArmand Philippot2023-11-292-274/+78
| | | | | | | | | * move custom homepage components that does not require props to the MDX file (links should not need to be translated here but where they are defined) * move SEO title and meta desc to MDX file * make Page component the wrapper instead of using a React fragment * fix MDX module types
* fix(pages,services): make thematics & topics pages usable againArmand Philippot2023-11-296-54/+54
| | | | | | | | | | When I refactored the fetchers and convertors in #f111685 I forgot to convert WPThematicPreview and WPTopicPreview so the thematics and topics pages was broken. I also: * removed the ToC added by error in #70b4f63 * fix heading styles * fix website url in topics pages
* refactor(services): avoid nested fetchersArmand Philippot2023-11-283-3/+7
| | | | | | | If we use fetchPostsCount inside fetchAllPostsSlugs, we might have problems to test fetchAllPostsSlugs failure. So it is better to let the consumer pass the posts count as an argument. The same applies to thematics and topics.
* refactor(services, types): reorganize GraphQL fetchers and data typesArmand Philippot2023-11-2710-172/+174
| | | | | | | | | | | | The Typescript mapped types was useful for autocompletion in fetchers but their are harder to maintain. I think it's better to keep each query close to its fetcher to have a better understanding of the fetched data. So I: * colocate queries with their own fetcher * colocate mutations with their own mutator * remove Typescript mapped types for queries and mutations * move data convertors inside graphql services * rename most of data types and fetchers
* refactor(components): integrate sectioned page template into PageArmand Philippot2023-11-231-6/+13
| | | | | | | | * replace Section component by a generic one (other components should be able to use it) * add a PageSection component * add `hasSections` prop to Page component * remove sectioned-page template
* refactor(components): replace items prop in Grid with children propArmand Philippot2023-11-222-91/+64
| | | | | | | | | It is easier to read and to maintain this way. The `items` prop was not useful since we are not manipulating the items. Changes: * extract GridItem component from Grid component * replace `items` prop of type Array<ReactNode> with `children` prop of type ReactNode * remove GridItem styles
* refactor(components,pages): extract MDX components mapping from pagesArmand Philippot2023-11-225-312/+14
| | | | | | | Instead of repeating the overriding on each pages, we should define it in one place and reuse it in pages. By default it is not possible to override native HTML tags with MDX so I added a plugin in next config to allow it.
* refactor(components): replace PageLayout template with PageArmand Philippot2023-11-2013-781/+591
| | | | | | | | | * split pages in smaller components (it is both easier to maintain and more readable, we avoid the use of fragments in pages directory) * extract breadcrumbs from article tag (the navigation is not related to the page contents) * remove useReadingTime hook * remove layout options except `isHome`
* refactor(components): extract MetaItem from MetaListArmand Philippot2023-11-2011-386/+364
| | | | | | * replace `items` prop on MetaList with `children` prop: it was too restrictive and the global options was not really useful. It is better too give control to the consumers.
* fix: generate an id for each headings in the page main contentsArmand Philippot2023-11-181-3/+11
| | | | | | | | | | | | | | | | | | | | Since #be4d907 the ids was no longer addded to headings in useHeadingsTree hook. It was a bad practice to manipulate the DOM that way. However, I did not move the implementation elsewhere... To fix this, I now use rehype-slug on both markdown contents and html string coming from WordPress. I'm not sure the dynamic imports are really useful here since the table of contents is on almost all pages but Jest was failing with regular import because of ESM. It is the only thing that makes the tests functional again so... However if we want to test the `updateContentTree` function, Jest fails for the same reason. So I decided to not test this function. I've already spend too much time on this issue. Another problem: the ToC on projects page. Currently we use the ref on the body but the page contents are imported dynamically so the hook is executed before the contents are loaded. It makes the ToC empty... We should refactor the pages so we can use the ref directly on the imported contents.
* refactor(hooks): remove useSettings hookArmand Philippot2023-11-1514-110/+92
| | | | | | | It does not make sense to re-export an existing object through a hook. On some pages both the hook and the object was imported... It is better to use the CONFIG (previously settings) object directly and by doing it we avoid potential errors because of conditional hooks.
* refactor(components): replace LinksListWidget with LinksWidgetArmand Philippot2023-11-146-36/+36
| | | | | | | * avoid List component repeat * rewrite tests and CSS * add an id to LinksWidgetItemData (previously LinksListItems) type because the label could be duplicated
* refactor(components): replace Sharing with SharingWidget componentArmand Philippot2023-11-142-4/+17
| | | | | | | * all the widgets should have a coherent name * fix mailto uri * remove useless CSS * add tests
* refactor(components): replace SocialMedia with SocialMediaWidgetArmand Philippot2023-11-132-4/+4
| | | | | | * the goal is to make the name of the widgets coherent * remove useless CSS * replace Media type with SocialMediaData
* refactor(components): rewrite ImageWidget componentArmand Philippot2023-11-131-3/+2
| | | | | | | | * remove `imageClassName` prop * replace `image` prop with `img` and expect an image instead of an object * remove `alignment prop` * remove useless CSS
* refactor(components): rewrite PostsList componentArmand Philippot2023-11-135-45/+215
| | | | | | | | | | | | | | | * remove NoResults component and move logic to Search page * add a usePostsList hook * remove Pagination from PostsList (it is only used if javascript is disabled and not on every posts list) * replace `byYear` prop with `sortByYear` * replace `loadMore` prop with `onLoadMore` * remove `showLoadMoreBtn` (we can use `loadMore` prop instead to determine if we need to display the button) * replace `titleLevel` prop with `headingLvl` * add `firstNewResult` prop to handle focus on the new results when loading more article (we should not focus a useless span but the item directly)
* refactor(hooks): rewrite usePagination hookArmand Philippot2023-11-132-22/+11
| | | | | | | * replace `isLoadingInitialData` with `isLoading` & `isRefreshing` * rename `fallbackData` prop to `fallback` * replace `setSize` return with a `loadMore` callback * add tests
* refactor(components): replace Overview with ProjectOverview componentArmand Philippot2023-11-111-123/+39
| | | | | | * `cover` prop is now expecting a ReactElement (NextImage) * `meta` prop is now limited to a specific set of meta items * add a `name` prop to add an accessible name to the figure element
* refactor(components): rewrite CommentsList componentArmand Philippot2023-11-111-1/+15
| | | | | | * use ApprovedCommentProps to make CommentData type * add the author name of the parent on reply form heading * add tests
* refactor(components): split Comment component into 3 componentsArmand Philippot2023-11-111-1/+31
| | | | | | | | | * add ApprovedComment, PendingComment and ReplyCommentForm components * let consumer handle reply form visibility * move structured data into article page (each article already has the comments data and already handle json ltd schema so I prefered to move the schema in the final consumer instead of adding a script element foreach comment)
* refactor(components): rewrite ContactForm componentArmand Philippot2023-11-111-39/+32
| | | | | | * remove `Notice` props to handle it directly inside the form * replace `sendMail` prop with `onSubmit` prop * use `useForm` hook to handle fields
* refactor(components): rewrite SearchForm componentArmand Philippot2023-11-116-7/+26
| | | | | | * remove searchPage prop (the consumer should handle the submit) * change onSubmit type * use `useForm` hook to handle the form
* refactor(providers,hooks): rewrite PrismThemeProvider & usePrismThemeArmand Philippot2023-11-112-3/+21
| | | | | | * reuse Theme provider logic * move DOM mutation from provider to hook * add a script to init theme before page load
* feat: replace next-themes with a custom ThemeProviderArmand Philippot2023-11-112-4/+12
| | | | | | | To be honest, next-themes was working fine. However since I use a theme provider for Prism code blocks, some code is duplicated between this app and the library. So I prefer to use a custom Provider without the options I don't need.
* refactor(hooks,provider): move reduce motion setterArmand Philippot2023-11-112-14/+49
| | | | | | | | | | Since the local storage key is not meant to change between the components, it should be set directly inside the app file. So both the local storage and the data attribute should be handle in a provider. I also added a custom document because we need a script to retrieve the stored value in local storage earlier to avoid flashing on hydration.
* refactor(hooks,providers): rewrite useAckee hook and AckeeProviderArmand Philippot2023-11-111-4/+10
|
* refactor(components): rewrite NavList componentArmand Philippot2023-11-112-2/+2
| | | | | | | * extract NavItem from NavList * remove `kind` and `listClassName` props (since the consumer has control over NavList, NavItem and NavLink components these props are obsolete)
* feat(components): add a generic Grid componentArmand Philippot2023-11-113-19/+56
| | | | | * merge Columns, Gallery and CardsList into Grid component * add more options to control the grid
* refactor(components): rewrite Card componentArmand Philippot2023-11-112-31/+100
| | | | | | | | | | | | | * make the component more generic * merge `<Summary />` and `<Comment />` styles into card component to avoid repeating the same structure * remove most of the props to use composition However the CSS is a bit complex because of the two variants... Also, the component should be refactored when the CSS pseudo-class `:has` has enough support: the provider and the `cover` and `meta` props should be removed.