Commit 2839abdd authored by Tim Neutkens's avatar Tim Neutkens

Update

parent fbfbb400
...@@ -6,31 +6,31 @@ export const typeDefs = gql` ...@@ -6,31 +6,31 @@ export const typeDefs = gql`
email: String! email: String!
createdAt: Int! createdAt: Int!
} }
input SignUpInput { input SignUpInput {
email: String! email: String!
password: String! password: String!
} }
input SignInInput { input SignInInput {
email: String! email: String!
password: String! password: String!
} }
type SignUpPayload { type SignUpPayload {
user: User! user: User!
} }
type SignInPayload { type SignInPayload {
user: User! user: User!
} }
type Query { type Query {
user(id: ID!): User! user(id: ID!): User!
users: [User]! users: [User]!
viewer: User viewer: User
} }
type Mutation { type Mutation {
signUp(input: SignUpInput!): SignUpPayload! signUp(input: SignUpInput!): SignUpPayload!
signIn(input: SignInInput!): SignInPayload! signIn(input: SignInInput!): SignInPayload!
......
...@@ -6,7 +6,7 @@ export const typeDefs = gql` ...@@ -6,7 +6,7 @@ export const typeDefs = gql`
name: String! name: String!
status: String! status: String!
} }
type Query { type Query {
viewer: User viewer: User
} }
......
...@@ -18,9 +18,9 @@ export default function LandingPageSection({ type, sectionData }) { ...@@ -18,9 +18,9 @@ export default function LandingPageSection({ type, sectionData }) {
), ),
two_column_with_image: dynamic( two_column_with_image: dynamic(
() => () =>
import( import("@/components/landing-page-sections/two-column-with-image").catch(
"@/components/landing-page-sections/two-column-with-image" () => () => MissingSection,
).catch(() => () => MissingSection), ),
{ {
loading: Preloader, loading: Preloader,
}, },
......
...@@ -36,7 +36,11 @@ export const Media: React.FC<Props> = (props) => { ...@@ -36,7 +36,11 @@ export const Media: React.FC<Props> = (props) => {
: {})} : {})}
> >
{ {
isVideo ? <Video {...props} /> : <Image {...props} /> // eslint-disable-line isVideo ? (
<Video {...props} />
) : (
<Image {...props} /> // eslint-disable-line
)
} }
</Tag> </Tag>
); );
......
...@@ -89,7 +89,6 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut ...@@ -89,7 +89,6 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
- WPGraphQL for ACF (optional) - WPGraphQL for ACF (optional)
6. Do first-time install of Redirection. Recommended to enable monitor of changes 6. Do first-time install of Redirection. Recommended to enable monitor of changes
7. Configure Yoast SEO with: 7. Configure Yoast SEO with:
- Disable XML Sitemaps under Yoast SEO -> Settings - Disable XML Sitemaps under Yoast SEO -> Settings
- If you did not change the `Site Address (URL)` before installing Yoast, it will ask you to run optimize SEO data after changing permalinks, do so - If you did not change the `Site Address (URL)` before installing Yoast, it will ask you to run optimize SEO data after changing permalinks, do so
- Generate a robots.txt file under Yoast SEO -> Tools -> File Editor - Generate a robots.txt file under Yoast SEO -> Tools -> File Editor
...@@ -119,7 +118,7 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut ...@@ -119,7 +118,7 @@ Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&ut
| `NEXT_PUBLIC_BASE_URL` | Insert base url of frontend | http://localhost:3000 | Used for generating sitemap, redirects etc. | | `NEXT_PUBLIC_BASE_URL` | Insert base url of frontend | http://localhost:3000 | Used for generating sitemap, redirects etc. |
| `NEXT_PUBLIC_WORDPRESS_API_URL` | Insert base url of your WordPress installation | http://wp-domain.com | Used when requesting wordpress for data | | `NEXT_PUBLIC_WORDPRESS_API_URL` | Insert base url of your WordPress installation | http://wp-domain.com | Used when requesting wordpress for data |
| `NEXT_PUBLIC_WORDPRESS_API_HOSTNAME` | The hostname without protocol for your WordPress installation | wp-domain.com | Used for dynamically populating the next.config images remotePatterns | | `NEXT_PUBLIC_WORDPRESS_API_HOSTNAME` | The hostname without protocol for your WordPress installation | wp-domain.com | Used for dynamically populating the next.config images remotePatterns |
| `HEADLESS_SECRET` | Insert the same random key, that you generated for your `wp-config.php` | INSERT_RANDOM_SECRET_KEY | Used for public exchanges between frontend and backend | | `HEADLESS_SECRET` | Insert the same random key, that you generated for your `wp-config.php` | INSERT_RANDOM_SECRET_KEY | Used for public exchanges between frontend and backend |
| `WP_USER` | Insert a valid WordPress username | username | Username for a system user created specifically for interacting with your WordPress installation | | `WP_USER` | Insert a valid WordPress username | username | Username for a system user created specifically for interacting with your WordPress installation |
| `WP_APP_PASS` | Insert application password | 1234 5678 abcd efgh | [Generate an application password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/) for the WordPress user defined in `WP_USER` | | `WP_APP_PASS` | Insert application password | 1234 5678 abcd efgh | [Generate an application password](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/) for the WordPress user defined in `WP_USER` |
......
...@@ -89,5 +89,4 @@ To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [ ...@@ -89,5 +89,4 @@ To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and [
- When you import your project on Vercel, make sure to click on **Environment Variables** and set the keys to match your `.env.local` file. - When you import your project on Vercel, make sure to click on **Environment Variables** and set the keys to match your `.env.local` file.
- For a cloud deployment on Vercel, the **Environment Variables** values will need to **correspond to a cloud instance of Couchbase** (localhost will **NOT** connect from a remote server such as Vercel). Find info on [getting started with Couchbase cloud](https://developer.couchbase.com/tutorial-cloud-getting-started/). - For a cloud deployment on Vercel, the **Environment Variables** values will need to **correspond to a cloud instance of Couchbase** (localhost will **NOT** connect from a remote server such as Vercel). Find info on [getting started with Couchbase cloud](https://developer.couchbase.com/tutorial-cloud-getting-started/).
- _Important:_ you will have to allowlist 0.0.0.0/0 as the IP address, since Vercel's serverless deployments use [dynamic IP addresses](https://vercel.com/docs/solutions/databases#allowing-&-blocking-ip-addresses) - _Important:_ you will have to allowlist 0.0.0.0/0 as the IP address, since Vercel's serverless deployments use [dynamic IP addresses](https://vercel.com/docs/solutions/databases#allowing-&-blocking-ip-addresses)
...@@ -25,14 +25,16 @@ bun create next-app --example with-docker nextjs-docker ...@@ -25,14 +25,16 @@ bun create next-app --example with-docker nextjs-docker
## Using Docker ## Using Docker
1. [Install Docker](https://docs.docker.com/get-docker/) on your machine. 1. [Install Docker](https://docs.docker.com/get-docker/) on your machine.
1. Build your container: 1. Build your container:
```bash
# For npm, pnpm or yarn ```bash
docker build -t nextjs-docker . # For npm, pnpm or yarn
docker build -t nextjs-docker .
# For bun
docker build -f Dockerfile.bun -t nextjs-docker . # For bun
``` docker build -f Dockerfile.bun -t nextjs-docker .
```
1. Run your container: `docker run -p 3000:3000 nextjs-docker`. 1. Run your container: `docker run -p 3000:3000 nextjs-docker`.
You can view your images created with `docker images`. You can view your images created with `docker images`.
...@@ -58,7 +60,6 @@ This will build the project as a standalone app inside the Docker image. ...@@ -58,7 +60,6 @@ This will build the project as a standalone app inside the Docker image.
1. [Create a new project](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) in Google Cloud Run (e.g. `nextjs-docker`). Ensure billing is turned on. 1. [Create a new project](https://cloud.google.com/run/docs/quickstarts/build-and-deploy) in Google Cloud Run (e.g. `nextjs-docker`). Ensure billing is turned on.
1. Build your container image using Cloud Build: `gcloud builds submit --tag gcr.io/PROJECT-ID/helloworld --project PROJECT-ID`. This will also enable Cloud Build for your project. 1. Build your container image using Cloud Build: `gcloud builds submit --tag gcr.io/PROJECT-ID/helloworld --project PROJECT-ID`. This will also enable Cloud Build for your project.
1. Deploy to Cloud Run: `gcloud run deploy --image gcr.io/PROJECT-ID/helloworld --project PROJECT-ID --platform managed --allow-unauthenticated`. Choose a region of your choice. 1. Deploy to Cloud Run: `gcloud run deploy --image gcr.io/PROJECT-ID/helloworld --project PROJECT-ID --platform managed --allow-unauthenticated`. Choose a region of your choice.
- You will be prompted for the service name: press Enter to accept the default name, `helloworld`. - You will be prompted for the service name: press Enter to accept the default name, `helloworld`.
- You will be prompted for [region](https://cloud.google.com/run/docs/quickstarts/build-and-deploy#follow-cloud-run): select the region of your choice, for example `us-central1`. - You will be prompted for [region](https://cloud.google.com/run/docs/quickstarts/build-and-deploy#follow-cloud-run): select the region of your choice, for example `us-central1`.
......
import { useGraphQL } from "graphql-react"; import { useGraphQL } from "graphql-react";
export default function IndexPage() { export default function IndexPage() {
const { const { loading, cacheValue: { data } = {} } = useGraphQL({
loading,
cacheValue: { data } = {},
} = useGraphQL({
fetchOptionsOverride(options) { fetchOptionsOverride(options) {
options.url = "https://graphql-pokemon.vercel.app"; options.url = "https://graphql-pokemon.vercel.app";
}, },
......
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
module.exports = { module.exports = {
/* this needs to be set to false until a bug in the compression npm module gets fixed. /* this needs to be set to false until a bug in the compression npm module gets fixed.
reference: https://github.com/expressjs/compression/issues/122 reference: https://github.com/expressjs/compression/issues/122
*/ */
compress: false, compress: false,
......
...@@ -16,8 +16,9 @@ type ToReact<T> = { ...@@ -16,8 +16,9 @@ type ToReact<T> = {
declare global { declare global {
export namespace JSX { export namespace JSX {
interface IntrinsicElements interface IntrinsicElements extends ToReact<
extends ToReact<IonicIntrinsicElements & IoniconsIntrinsicElements> { IonicIntrinsicElements & IoniconsIntrinsicElements
> {
key?: string; key?: string;
} }
} }
......
...@@ -34,7 +34,6 @@ pnpm create next-app --example with-oxlint with-oxlint-app ...@@ -34,7 +34,6 @@ pnpm create next-app --example with-oxlint with-oxlint-app
## Linting the application ## Linting the application
```bash ```bash
npm run lint npm run lint
``` ```
......
...@@ -2,9 +2,7 @@ import { useUser, fetcher } from "../lib/hooks"; ...@@ -2,9 +2,7 @@ import { useUser, fetcher } from "../lib/hooks";
import useSWR from "swr"; import useSWR from "swr";
function UserList() { function UserList() {
const { const { data: { users } = {} } = useSWR("/api/users", fetcher);
data: { users } = {},
} = useSWR("/api/users", fetcher);
return ( return (
<> <>
<h2>All users</h2> <h2>All users</h2>
......
...@@ -2,7 +2,8 @@ import React, { ReactElement, AnchorHTMLAttributes } from "react"; ...@@ -2,7 +2,8 @@ import React, { ReactElement, AnchorHTMLAttributes } from "react";
import Link, { LinkProps } from "next/link"; import Link, { LinkProps } from "next/link";
export interface LinkUnstyledProps export interface LinkUnstyledProps
extends Omit<LinkProps, "children" | "onError">, extends
Omit<LinkProps, "children" | "onError">,
Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "onError" | "href"> {} Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "onError" | "href"> {}
export default function LinkUnstyled({ export default function LinkUnstyled({
......
...@@ -26,8 +26,7 @@ export namespace Components { ...@@ -26,8 +26,7 @@ export namespace Components {
declare global { declare global {
interface HTMLMyComponentElement interface HTMLMyComponentElement
extends Components.MyComponent, extends Components.MyComponent, HTMLStencilElement {}
HTMLStencilElement {}
var HTMLMyComponentElement: { var HTMLMyComponentElement: {
prototype: HTMLMyComponentElement; prototype: HTMLMyComponentElement;
new (): HTMLMyComponentElement; new (): HTMLMyComponentElement;
......
...@@ -75,16 +75,17 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps ...@@ -75,16 +75,17 @@ If you wish to just develop locally and not deploy to Vercel, [follow the steps
4. Rename `.env.example` to `.env.local` and update the following: 4. Rename `.env.example` to `.env.local` and update the following:
```env ```env
NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL] NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL]
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[INSERT SUPABASE PROJECT API PUBLISHABLE OR ANON KEY] NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[INSERT SUPABASE PROJECT API PUBLISHABLE OR ANON KEY]
``` ```
> [!NOTE]
> This example uses `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`, which refers to Supabase's new **publishable** key format. > [!NOTE]
> Both legacy **anon** keys and new **publishable** keys can be used with this variable name during the transition period. Supabase's dashboard may show `NEXT_PUBLIC_SUPABASE_ANON_KEY`; its value can be used in this example. > This example uses `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`, which refers to Supabase's new **publishable** key format.
> See the [full announcement](https://github.com/orgs/supabase/discussions/29260) for more information. > Both legacy **anon** keys and new **publishable** keys can be used with this variable name during the transition period. Supabase's dashboard may show `NEXT_PUBLIC_SUPABASE_ANON_KEY`; its value can be used in this example.
> See the [full announcement](https://github.com/orgs/supabase/discussions/29260) for more information.
Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` can be found in [your Supabase project's API settings](https://supabase.com/dashboard/project/_?showConnect=true)
Both `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` can be found in [your Supabase project's API settings](https://supabase.com/dashboard/project/_?showConnect=true)
5. You can now run the Next.js local development server: 5. You can now run the Next.js local development server:
......
...@@ -24,7 +24,8 @@ const badgeVariants = cva( ...@@ -24,7 +24,8 @@ const badgeVariants = cva(
); );
export interface BadgeProps export interface BadgeProps
extends React.HTMLAttributes<HTMLDivElement>, extends
React.HTMLAttributes<HTMLDivElement>,
VariantProps<typeof badgeVariants> {} VariantProps<typeof badgeVariants> {}
function Badge({ className, variant, ...props }: BadgeProps) { function Badge({ className, variant, ...props }: BadgeProps) {
......
...@@ -35,7 +35,8 @@ const buttonVariants = cva( ...@@ -35,7 +35,8 @@ const buttonVariants = cva(
); );
export interface ButtonProps export interface ButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement>, extends
React.ButtonHTMLAttributes<HTMLButtonElement>,
VariantProps<typeof buttonVariants> { VariantProps<typeof buttonVariants> {
asChild?: boolean; asChild?: boolean;
} }
......
...@@ -4,8 +4,10 @@ import { type PropsWithChildren, useRef } from "react"; ...@@ -4,8 +4,10 @@ import { type PropsWithChildren, useRef } from "react";
import type { StoreInterface, StoreType } from "./store"; import type { StoreInterface, StoreType } from "./store";
import { initializeStore, Provider } from "./store"; import { initializeStore, Provider } from "./store";
export interface PreloadedStoreInterface export interface PreloadedStoreInterface extends Pick<
extends Pick<StoreInterface, "lastUpdate"> {} StoreInterface,
"lastUpdate"
> {}
export default function StoreProvider({ export default function StoreProvider({
children, children,
......
...@@ -26,7 +26,9 @@ export default async function Page() { ...@@ -26,7 +26,9 @@ export default async function Page() {
<h1 id="title">revalidate</h1> <h1 id="title">revalidate</h1>
<p> <p>
{' '} {' '}
revalidate (tags: thankyounext): <span id="thankyounext">{data}</span>{' '} revalidate (tags: thankyounext): <span id="thankyounext">
{data}
</span>{' '}
<span> <span>
<Link href="/revalidate-2" id="another"> <Link href="/revalidate-2" id="another">
/revalidate-2 /revalidate-2
......
...@@ -2,20 +2,18 @@ import { ImageResponse } from 'next/og' ...@@ -2,20 +2,18 @@ import { ImageResponse } from 'next/og'
export default function og() { export default function og() {
return new ImageResponse( return new ImageResponse(
( <div
<div style={{
style={{ width: '100%',
width: '100%', height: '100%',
height: '100%', display: 'flex',
display: 'flex', alignItems: 'center',
alignItems: 'center', justifyContent: 'center',
justifyContent: 'center', fontSize: 128,
fontSize: 128, background: 'lavender',
background: 'lavender', }}
}} >
> Open Graph
Open Graph </div>
</div>
)
) )
} }
...@@ -17,22 +17,20 @@ export default async function Icon() { ...@@ -17,22 +17,20 @@ export default async function Icon() {
const letter = await fetchIconLetter() const letter = await fetchIconLetter()
return new ImageResponse( return new ImageResponse(
( <div
<div style={{
style={{ fontSize: 24,
fontSize: 24, background: 'black',
background: 'black', width: '100%',
width: '100%', height: '100%',
height: '100%', display: 'flex',
display: 'flex', alignItems: 'center',
alignItems: 'center', justifyContent: 'center',
justifyContent: 'center', color: 'white',
color: 'white', }}
}} >
> {letter}
{letter} </div>,
</div>
),
{ ...size } { ...size }
) )
} }
...@@ -14,25 +14,23 @@ export default async function Image() { ...@@ -14,25 +14,23 @@ export default async function Image() {
const post = await fetchPostData() const post = await fetchPostData()
return new ImageResponse( return new ImageResponse(
( <div
<div style={{
style={{ fontSize: 48,
fontSize: 48, background: 'white',
background: 'white', width: '100%',
width: '100%', height: '100%',
height: '100%', display: 'flex',
display: 'flex', alignItems: 'center',
alignItems: 'center', justifyContent: 'center',
justifyContent: 'center', flexDirection: 'column',
flexDirection: 'column', }}
}} >
> <h1>{post.title}</h1>
<h1>{post.title}</h1> <p style={{ fontSize: 32 }}>
<p style={{ fontSize: 32 }}> {new Date(post.created).toLocaleTimeString()}
{new Date(post.created).toLocaleTimeString()} </p>
</p> </div>,
</div>
),
size size
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment