aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* refactor(pages): refine Contact pageArmand Philippot2023-12-117-76/+80
| | | | | | | * 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-092-8/+6
| | | | | | * remove unnecessary dependency (useRouter) * fix React errors (blurWidth/blurHeight) * complete Cypress tests
* refactor(pages): refine 404 pageArmand Philippot2023-12-095-103/+162
| | | | | * refresh topics and thematics list using hooks * add Cypress tests
* refactor(pages): refine Project pagesArmand Philippot2023-12-0823-327/+499
| | | | | | | | | | | * 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-0712-48/+222
| | | | | | | | * 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-079-106/+135
| | | | | | | * 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-076-214/+277
| | | | | | | * 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-0418-375/+637
| | | | | | | | | | * 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-0113-94/+342
| | | | | | * add useTopic and useTopicsList hooks to refresh data * add a table of contents * add Cypress tests
* refactor(pages): refine Thematic pagesArmand Philippot2023-12-0121-109/+389
| | | | | | | | | | | * 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-0131-336/+630
| | | | | | | | | | | * 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-308-79/+125
| | | | | | | | | | | * 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-292-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-2919-430/+212
| | | | | | | | | * 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-2920-72/+815
| | | | | | | | | | 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
* fix(services,types): make queries and types coherent for TopicArmand Philippot2023-11-289-6/+110
| | | | | | * some nodes was missing in topicQuery * a node was mispelled in topicsListQuery * add tests for all topics fetchers
* fix(services,types): make coherent Thematic type and queryArmand Philippot2023-11-289-14/+121
| | | | | | * some nodes was queried but missing in the Thematic type and vice versa, it is now fixed * add tests for all thematics fetchers
* test(services): add tests for comments list fetcherArmand Philippot2023-11-282-1/+27
|
* test(services): add tests for posts fetchersArmand Philippot2023-11-2814-36/+233
|
* refactor(services): avoid nested fetchersArmand Philippot2023-11-286-15/+18
| | | | | | | 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-2785-2216/+2579
| | | | | | | | | | | | 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): refine Card component stylesArmand Philippot2023-11-231-15/+29
| | | | | | | * remove cover img absolute positioning * remove fixed height on card variant 1 * make title always centered on card variant 2 * make header meta centered on card variant 2 on small containers
* refactor(components): integrate sectioned page template into PageArmand Philippot2023-11-2319-346/+254
| | | | | | | | * 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-229-204/+309
| | | | | | | | | 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-2210-320/+112
| | | | | | | 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): split Layout component in smaller componentsArmand Philippot2023-11-2225-757/+978
| | | | | The previous component was too long and hardly readable. So I splitted it in different part and added tests.
* refactor(components): replace items prop in Navbar componentArmand Philippot2023-11-2115-404/+216
| | | | | | | | | | | | | | * replace `items` prop with `children` prop: it is more readable this way, * handle navbar item state inside NavbarItem component: it avoid using three differents states and their methods to do exactly the same thing * remove useAutofocus hook since we can't use it anymore * add `onActivation` and `activationHandlerDelay` prop to NavbarItem component to be able to focus the search input only when the item is activated (it replicates the functioning of useAutofocus hook) * replace `ref` type in SearchForm component: it does not make sense to use an input ref for a form. Instead I use useImperativeHandle to provide different a focus method to the given ref.
* refactor(components): replace PageLayout template with PageArmand Philippot2023-11-2055-2513/+2602
| | | | | | | | | * 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`
* fix: remove rehype-sanitize to avoid broken layoutsArmand Philippot2023-11-201-2/+0
| | | | | | | The `rehype-sanitize` plugin was removing some tags inside the post contents coming from WordPress so the layout was broken. This plugin is useful to avoid DOM clobbering but I trust rehype-slug and myself so it is safe to remove it.
* refactor(components): extract MetaItem from MetaListArmand Philippot2023-11-2029-974/+787
| | | | | | * 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-1815-117/+179
| | | | | | | | | | | | | | | | | | | | 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.
* build(components, hooks): fix type errors introduced by deps upgradeArmand Philippot2023-11-163-6/+9
| | | | Since #7e37f2b Typescript was complaining about some types.
* feat(components): add an option to CommentsList to forbid repliesArmand Philippot2023-11-163-4/+56
|
* refactor(hooks): remove unused hooksArmand Philippot2023-11-153-47/+0
| | | | | * useMutationObserver removed * useStateChange removed
* refactor(hooks): replace useRouteChange with useOnRouteChange hookArmand Philippot2023-11-156-14/+109
| | | | | | * handle both event start and event complete * clean the effect * add tests
* refactor(hooks): rewrite useScrollPosition hookArmand Philippot2023-11-155-27/+67
| | | | | | * return the scroll position (both X and Y) * no longer accepts arguments * add tests
* refactor(hooks): remove useSettings hookArmand Philippot2023-11-1525-276/+162
| | | | | | | 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, hooks): rewrite ToC and useHeadingsTreeArmand Philippot2023-11-1416-298/+386
| | | | | | | | | | | | * replace TableOfContents component with TocWidget to keep the name of widget components coherent * replace `wrapper` prop with `tree` prop (the component no longer uses the hook, it is up to the consumer to provide the headings tree) * let consumer handle the widget title * add options to useHeadingsTree hook to retrieve only the wanted headings (and do not assume that h1 is unwanted) * expect an ref object instead of an element in useHeadingsTree hook * rename most of the types involved
* refactor(components): replace LinksListWidget with LinksWidgetArmand Philippot2023-11-1419-359/+360
| | | | | | | * 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-1414-396/+431
| | | | | | | * all the widgets should have a coherent name * fix mailto uri * remove useless CSS * add tests
* refactor(components): replace SocialMedia with SocialMediaWidgetArmand Philippot2023-11-1310-102/+81
| | | | | | * 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-1310-338/+255
| | | | | | | | * 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-1332-731/+859
| | | | | | | | | | | | | | | * 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-136-141/+244
| | | | | | | * 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-1115-368/+550
| | | | | | * `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-1117-343/+726
| | | | | | * 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-1128-468/+786
| | | | | | | | | * 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): replace Summary component with PostPreviewArmand Philippot2023-11-1123-539/+997
| | | | | | | | | | | * rename component to PostPreview because Summary is an HTML element and it could lead to confusion * replace `title` and `titleLevel` with `heading` and `headingLvl` because `title` is a native attribute * rename `intro` prop to `excerpt` * extract `cover` from `meta` prop * rewrite meta type * extract meta logic into a new component
* refactor(components): rewrite CommentForm componentArmand Philippot2023-11-1116-456/+390
| | | | | | * remove `Notice` prop to handle it directly in the form * replace `saveComment` prop with `onSubmit` * use `useForm` hook to handle the form
* refactor(components): rewrite ContactForm componentArmand Philippot2023-11-118-304/+348
| | | | | | * remove `Notice` props to handle it directly inside the form * replace `sendMail` prop with `onSubmit` prop * use `useForm` hook to handle fields