Skip to content

Commit

Permalink
Fix welcome page rendering with no login for UX reasons.
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed Feb 20, 2025
1 parent 0c01318 commit 7ddc540
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 39 deletions.
3 changes: 2 additions & 1 deletion src/examples/rest-with-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"graphql": "16.10.0",
"graphweaver": "workspace:*",
"mysql2": "3.12.0",
"react": "19.0.0"
"react": "19.0.0",
"wouter": "3.6.0"
},
"devDependencies": {
"@types/node": "22.10.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,58 @@
import {
Arrow,
Button,
localStorageAuthKey,
Spacer,
WelcomePage as WelcomePageLayout,
} from '@exogee/graphweaver-admin-ui-components';
import { Redirect } from 'wouter';
import styles from './styles.module.css';

export const WelcomePage = () => (
<WelcomePageLayout skipPath="/User">
<Spacer height={30} />
<h2 className={styles.heading}>Rest + Full Auth Example</h2>
<Spacer height={30} />
<p>
This example shows a MySQL database joined with a simple REST API with Graphweaver. Full auth
/ RBAC / multi-factor / etc is also demonstrated.
</p>
<Spacer height={20} />
<p>
In this example, there are two roles. Light side users are only able to see and manage their
own tasks, while dark side users can see and manage all tasks. When creating a task, the
application will prompt for step-up multifactor auth.
</p>
<Spacer height={20} />
<p>
To get started, copy the .env.example file to just .env, then follow the steps in the readme
to generate your keys.
</p>
<Spacer height={10} />
<p>
If you're stuck,{' '}
<a
href="https://join.slack.com/t/graphweaver/shared_invite/zt-2hxeb04d3-reNTqeVUAWy2YVXWscWRaw"
target="_blank"
rel="noopener noreferrer"
>
reach out to us on Slack
</a>
. We're here to help!
</p>
<Spacer height={30} />
<Button className={styles.button} href="/User">
Get started! <Arrow className={styles.arrow} />
</Button>
</WelcomePageLayout>
);
export const WelcomePage = () => {
// This specific welcome page should pretend to need auth. There's nothing secret about this
// content, but because it doesn't actually make any API calls, it would normally render.
//
// It's better for UX if we redirect to the login page instead.
if (!localStorage.getItem(localStorageAuthKey)) {
return <Redirect to={`/auth/login?redirect_uri=${encodeURIComponent('/welcome')}`} />;
}

return (
<WelcomePageLayout skipPath="/User">
<Spacer height={30} />
<h2 className={styles.heading}>Rest + Full Auth Example</h2>
<Spacer height={30} />
<p>
This example shows a MySQL database joined with a simple REST API with Graphweaver. Full
auth / RBAC / multi-factor / etc is also demonstrated.
</p>
<Spacer height={20} />
<p>
In this example, there are two roles. Light side users are only able to see and manage their
own tasks, while dark side users can see and manage all tasks. When creating a task, the
application will prompt for step-up multifactor auth.
</p>
<Spacer height={20} />
<p>
To get started, copy the .env.example file to just .env, then follow the steps in the readme
to generate your keys.
</p>
<Spacer height={10} />
<p>
If you're stuck,{' '}
<a
href="https://join.slack.com/t/graphweaver/shared_invite/zt-2hxeb04d3-reNTqeVUAWy2YVXWscWRaw"
target="_blank"
rel="noopener noreferrer"
>
reach out to us on Slack
</a>
. We're here to help!
</p>
<Spacer height={30} />
<Button className={styles.button} href="/User">
Get started! <Arrow className={styles.arrow} />
</Button>
</WelcomePageLayout>
);
};
3 changes: 3 additions & 0 deletions src/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ddc540

Please sign in to comment.