Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql #5

Merged
merged 34 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9de0031
Switch to using graphql for node and view data
pookmish Jan 3, 2024
d61b4bf
Updated readme and some various bits
pookmish Jan 8, 2024
39c9cde
fixed gitpod
pookmish Jan 8, 2024
0f9ce15
Eager load top banner images and better metadata on homepage
pookmish Jan 8, 2024
8d82414
Simplify view component and add image sizes for fill items
pookmish Jan 18, 2024
2470f89
Simplify get entity from path return data
pookmish Jan 18, 2024
cc32333
Use fetch api for graphql queries to improve cache mechanism
pookmish Jan 18, 2024
54fb65a
Adjusted graphql types for easier properties
pookmish Jan 22, 2024
ce4b564
Use route handler for page invalidation
pookmish Jan 25, 2024
8cb6ce4
adjust news card link path
pookmish Jan 26, 2024
c65de57
fetch config pages and menu using graphql
pookmish Jan 27, 2024
a435867
adjust list paragraph arguments
pookmish Jan 27, 2024
fa87162
Update search results state to be a single state
pookmish Jan 28, 2024
deda5c7
add readme cache info
pookmish Jan 30, 2024
1ea0e51
update packages
pookmish Jan 30, 2024
f00981b
disable link prefetching
pookmish Jan 31, 2024
f74a7ef
simplify link
pookmish Jan 31, 2024
9d0fd10
moved suspense to correct place
pookmish Jan 31, 2024
abcfa86
Exit draft mode immediately
pookmish Feb 1, 2024
bf643c6
Fixed timezones on news and policy pages
pookmish Feb 1, 2024
1f00f1c
Add missing fields for event view items
pookmish Feb 1, 2024
0094823
Fixed timezones settings
pookmish Feb 2, 2024
9362104
Added algolia search results if configured
pookmish Feb 2, 2024
f84b2ac
Updated all storybook stories
pookmish Feb 6, 2024
9e5d443
update packages
pookmish Feb 6, 2024
83df035
Add ESLint deprecation linting
pookmish Feb 9, 2024
a6b9a88
Better typescripting
pookmish Feb 11, 2024
7759989
Set gitpod environment variable
pookmish Feb 12, 2024
5edeebb
Dynamically set git remote origin url
pookmish Feb 12, 2024
974d295
Added card paragraph story
pookmish Feb 12, 2024
eddfff5
set gitpod remote url correctly
pookmish Feb 12, 2024
1b4848f
Merge branch 'main' into graphql
pookmish Feb 12, 2024
86b82d5
fixed gitpod steps
pookmish Feb 12, 2024
ab91d1c
fixup
pookmish Feb 12, 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
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
NEXT_PUBLIC_DRUPAL_BASE_URL=https://dev.next-drupal.org

# Required for On-demand Revalidation.
DRUPAL_REVALIDATE_SECRET=DRUPAL_REVALIDATE_SECRET
#DRUPAL_REVALIDATE_SECRET=DRUPAL_REVALIDATE_SECRET

# Draft mode credentials.
#DRUPAL_PREVIEW_SECRET=DRUPAL_PREVIEW_SECRET
Expand All @@ -11,4 +11,4 @@ DRUPAL_REVALIDATE_SECRET=DRUPAL_REVALIDATE_SECRET

# Change this to 'true' to fetch all pages and build each one.
# Recommended to enable this for production environment.
BUILD_COMPLETE=false
#BUILD_COMPLETE=false
9 changes: 8 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.json"
},
"extends": [
"next/core-web-vitals",
"plugin:storybook/recommended"
"plugin:storybook/recommended",
"plugin:deprecation/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
Expand Down
16 changes: 6 additions & 10 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ additionalRepositories:
- url: https://github.com/SU-SWS/acsf-cardinalsites-public
checkoutLocation: back
checkoutLocation: front
github:
prebuilds:
master: true
branches: true
pullRequests: true
pullRequestsFromForks: false
addCheck: false
addComment: false
addBadge: true
ports:
- name: database
description: Mysql database
Expand Down Expand Up @@ -39,6 +30,9 @@ tasks:
init: >
eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) &&
cd /workspace/back &&
rm -rf config/default &&
mkdir -p config/default &&
touch config/default/core.extension.yml &&
git checkout composer.* &&
composer install --no-interaction &&
mkdir -p blt &&
Expand All @@ -52,6 +46,7 @@ tasks:
blt settings &&
blt drupal:install -n &&
cd /workspace/front &&
cp .env.example .env.local &&
yarn install
command: |
cd /workspace/back &&
Expand All @@ -72,6 +67,7 @@ tasks:
echo 'Connecting Drupal to Frontend' &&
cd /workspace/front &&
yarn install &&
sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=$NEXT_PUBLIC_DRUPAL_BASE_URL|g" .env.local &&
yarn dev &
gp ports await 3000 &&
gp url 3000 | xargs gp preview --external
Expand All @@ -91,7 +87,7 @@ tasks:
[[ ! -z $GITCONFIG ]] &&
echo $GITCONFIG | base64 -d > ~/.gitconfig &&
chmod 644 ~/.gitconfig
# git remote set-url origin [email protected]:SU-SWS/sulgryphon-nextjs.git
git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|[email protected]:\1|')

vscode:
extensions:
Expand Down
26 changes: 16 additions & 10 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
// @ts-nocheck
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
import path from "path";
import type {StorybookConfig} from "@storybook/nextjs";

const path = require("path");

const config: StorybookConfig = {
framework: {
name: "@storybook/nextjs",
options: {
builder: {
useSWC: true,
},
},
},
typescript: {
reactDocgen: 'react-docgen',
check: false,
},
stories: [
"./stories/**/*.mdx",
"./stories/**/*.stories.@(js|jsx|ts|tsx)"
Expand All @@ -22,17 +33,12 @@ const config: StorybookConfig = {
},
},
],
framework: {
name: "@storybook/nextjs",
options: {},
},
docs: {
autodocs: "tag",
},
webpackFinal: async (config) => {
config.resolve.alias['@components'] = path.resolve(__dirname, '../src/components')
config.resolve.alias['@lib'] = path.resolve(__dirname, '../src/lib')
if (config.resolve) config.resolve.plugins = [new TsconfigPathsPlugin()];
return config
}
},
};
export default config;
100 changes: 23 additions & 77 deletions .storybook/stories/config-pages/GlobalMessage.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,99 +1,45 @@
import type {Meta, StoryObj} from '@storybook/react';

import GlobalMessage from "@components/config-pages/global-message/global-message";
import GlobalMessage from "@components/config-pages/global-message";
import {ComponentProps} from "react";
import {Link, Text} from "@lib/gql/__generated__/drupal";

type ComponentStoryProps = ComponentProps<typeof GlobalMessage> & {
messageText?: Text["processed"]
linkUrl?: Link["url"]
linkTitle?: Link["title"]
}

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<typeof GlobalMessage> = {
const meta: Meta<ComponentStoryProps> = {
title: 'Design/Config Pages/Global Message',
component: GlobalMessage,
tags: ['autodocs'],
argTypes: {
type: {
description: 'The type of global message',
suGlobalMsgType: {
options: ['info', 'success', 'warning', 'error', 'plain'],
control: {type: 'select'}
},
message: {
description: "General message html text",
},
label: {
description: "Text placed to the right of the icon"
},
header: {
description: "H2 element at the top."
},
linkText: {
description: "Link text for the bottom link"
},
linkUrl: {
description: "Absolute or relative url"
},
enabled: {
description: "Toggle the display on or off"
},
link: {
table: {
disable: true,
},
}
suGlobalMsgEnabled: {control: "boolean"}
}
};

export default meta;
type Story = StoryObj<typeof GlobalMessage>;
type Story = StoryObj<ComponentStoryProps>;

// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
export const SuccessMessage: Story = {
render: ({linkUrl, linkText, ...args}) => {
if(linkUrl && linkText) {
args.link = {
title: linkText,
url: linkUrl,
uri: linkUrl,
}
}
render: ({linkUrl, linkTitle, messageText, ...args}) => {
if (messageText) args.suGlobalMsgMessage = {processed: messageText}
if (linkUrl && linkTitle) args.suGlobalMsgLink = {url: linkUrl, title: linkTitle, internal: false}
return <GlobalMessage {...args}/>
},
args: {
type: 'success',
message: '<p>Rutrum nec ipsum lacus portaest cursus orci dolor gravida gravida eget nulla ipsum elementum leo enim vivamus quam lorem tempus quis cursus sem nec pellentesque. <a href="#">Link text</a></p><p><a class="su-button" href="#">Button text</a></p><p><a class="su-button--secondary" href="#">Secondary text</a></p>',
label: 'Placerat lacus ut eget leo.',
header: 'Accumsan eget amet id sollicitudin.',
linkText: 'Sem quisque placerat quis suspendisse.',
linkUrl: 'http://localhost',
enabled: true,
suGlobalMsgType: 'success',
messageText: '<p>Rutrum nec ipsum lacus portaest cursus orci dolor gravida gravida eget nulla ipsum elementum leo enim vivamus quam lorem tempus quis cursus sem nec pellentesque. <a href="#">Link text</a></p><p><a class="su-button" href="#">Button text</a></p><p><a class="su-button--secondary" href="#">Secondary text</a></p>',
suGlobalMsgLabel: 'Placerat lacus ut eget leo.',
suGlobalMsgHeader: 'Accumsan eget amet id sollicitudin.',
linkTitle: 'Sem quisque placerat quis suspendisse.',
linkUrl: '#',
suGlobalMsgEnabled: true,
},
};

export const InfoMessage: Story = {
render: SuccessMessage.render,
args: {
...SuccessMessage.args,
type: "info",
}
}

export const ErrorMessage: Story = {
render: SuccessMessage.render,
args: {
...SuccessMessage.args,
type: "error",
}
}

export const WarningMessage: Story = {
render: SuccessMessage.render,
args: {
...SuccessMessage.args,
type: "warning",
}
}


export const PlainMessage: Story = {
render: SuccessMessage.render,
args: {
...SuccessMessage.args,
type: "plain",
}
}
Loading
Loading