Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Move Pages to App Router #7

Merged
merged 26 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d24e85f
Move process page to app
acouch May 22, 2024
ee9984c
Move research page to app
acouch May 22, 2024
49c4c6c
Move health page to app
acouch May 22, 2024
93a665f
Move feature flag page to app
acouch May 22, 2024
1e8a63e
Move search page to app router
acouch May 22, 2024
495f55e
Move newsletter pages to app router
acouch May 22, 2024
0d35fb2
Move home page to app router
acouch May 22, 2024
3f35ec6
Delete hello api
acouch May 22, 2024
50ae02d
Move home page to app router
acouch May 22, 2024
2b85d7f
Add USWDS icon component
acouch May 22, 2024
963341d
Move 404 page to app router
acouch May 22, 2024
416fc94
Move layout and update for app router
acouch May 22, 2024
d92709f
Remove unused WtGIContent
acouch May 22, 2024
b5d3aa1
Move layout and update for app router
acouch May 22, 2024
0d2fbbb
Move layout and update for app router
acouch May 22, 2024
08df166
Move i18n strings for app router
acouch May 22, 2024
d15ab35
Update global components for the app router
acouch May 22, 2024
9d53f86
Adds next-intl config and removes i18n
acouch May 22, 2024
321c9bc
Update tests for app router
acouch May 22, 2024
e022f9c
Removes i18next and next-i18n packages
acouch May 22, 2024
fab1ffa
Update storybook settings for app router
acouch May 22, 2024
061c5b5
newsletter timeout
rylew1 May 23, 2024
3e1236f
Update playwright.config.ts to increase timeout
acouch May 23, 2024
c51c906
fix flipping sort order search test
rylew1 May 23, 2024
e311819
Update playwright config
acouch May 23, 2024
c40b27b
Update tests for newsletter and dev server
acouch May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions frontend/.storybook/I18nStoryWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* @file Storybook decorator, enabling internationalization for each story.
* @see https://storybook.js.org/docs/writing-stories/decorators
*/
import { StoryContext } from "@storybook/react";

import { NextIntlClientProvider } from "next-intl";
import React from "react";

import { defaultLocale, formats, timeZone } from "../src/i18n/config";

const I18nStoryWrapper = (
Story: React.ComponentType,
context: StoryContext,
) => {
const locale = (context.globals.locale as string) ?? defaultLocale;

return (
<NextIntlClientProvider
formats={formats}
timeZone={timeZone}
locale={locale}
messages={context.loaded.messages as undefined}
>
<Story />
</NextIntlClientProvider>
);
};

export default I18nStoryWrapper;
22 changes: 0 additions & 22 deletions frontend/.storybook/i18next.js

This file was deleted.

6 changes: 1 addition & 5 deletions frontend/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ function blockSearchEnginesInHead(head) {
*/
const config = {
stories: ["../stories/**/*.stories.@(mdx|js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-essentials",
"storybook-react-i18next",
"@storybook/addon-designs",
],
addons: ["@storybook/addon-essentials", "@storybook/addon-designs"],
framework: {
name: "@storybook/nextjs",
options: {
Expand Down
43 changes: 0 additions & 43 deletions frontend/.storybook/preview.js

This file was deleted.

64 changes: 64 additions & 0 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* @file Setup the toolbar, styling, and global context for each Storybook story.
* @see https://storybook.js.org/docs/configure#configure-story-rendering
*/
import { Loader, Preview } from "@storybook/react";

import "../src/styles/styles.scss";

import { defaultLocale, locales } from "../src/i18n/config";
import { getMessagesWithFallbacks } from "../src/i18n/getMessagesWithFallbacks";
import I18nStoryWrapper from "./I18nStoryWrapper";

const parameters = {
nextjs: {
appDirectory: true,
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
options: {
storySort: {
method: "alphabetical",
order: [
"Welcome",
"Core",
// Storybook infers the title when not explicitly set, but is case-sensitive
// so we need to explicitly set both casings here for this to properly sort.
"Components",
"components",
"Templates",
"Pages",
"pages",
],
},
},
};

const i18nMessagesLoader: Loader = async (context) => {
const messages = await getMessagesWithFallbacks(
context.globals.locale as string,
);
return { messages };
};

const preview: Preview = {
loaders: [i18nMessagesLoader],
decorators: [I18nStoryWrapper],
parameters,
globalTypes: {
locale: {
description: "Active language",
defaultValue: defaultLocale,
toolbar: {
icon: "globe",
items: locales,
},
},
},
};

export default preview;
5 changes: 1 addition & 4 deletions frontend/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ const createJestConfig = nextJest({
// Add any custom config to be passed to Jest
/** @type {import('jest').Config} */
const customJestConfig = {
setupFilesAfterEnv: [
"<rootDir>/tests/jest.setup.js",
"<rootDir>/tests/jest-i18n.ts",
],
setupFilesAfterEnv: ["<rootDir>/tests/jest.setup.js"],
testEnvironment: "jsdom",
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ["node_modules", "<rootDir>/"],
Expand Down
52 changes: 0 additions & 52 deletions frontend/next-i18next.config.js

This file was deleted.

8 changes: 1 addition & 7 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
const { i18n } = require("./next-i18next.config");

const withNextIntl = require("next-intl/plugin")("./src/i18n/server.ts");
const sassOptions = require("./scripts/sassOptions");

Expand All @@ -16,17 +16,11 @@ const appSassOptions = sassOptions(basePath);
/** @type {import('next').NextConfig} */
const nextConfig = {
basePath,
i18n,
reactStrictMode: true,
// Output only the necessary files for a deployment, excluding irrelevant node_modules
// https://nextjs.org/docs/app/api-reference/next-config-js/output
output: "standalone",
sassOptions: appSassOptions,
transpilePackages: [
// Continue to support older browsers (ES5)
// https://github.com/i18next/i18next/issues/1948
"i18next",
],
};

module.exports = withNextIntl(nextConfig);
Loading
Loading