Skip to content

Commit

Permalink
✨ Style Login Page (#15)
Browse files Browse the repository at this point in the history
rebase with upstream

i dont understand why

refactor backgrounds, adjust responsive

update unit tests

again

fix conflicts

fix readme dups and lock conflict

update scripts

rebase

fix merge

fix readme dups and lock conflict

add missing scripts

another

Adjust workflows, fix codeql (#18)

* test codeql

* tweak workflows to follow github docs
fix conflicts

fix readme dups and lock conflict

rebase

more cleanup

fix e2e

all up to date. hopefully
  • Loading branch information
archae0pteryx authored and Kevin Craine committed Feb 21, 2023
1 parent 62f0305 commit 1405af7
Show file tree
Hide file tree
Showing 85 changed files with 2,110 additions and 1,335 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ scripts/*
web/playwright-report
*pw.json
.yarnrc.yml
web/config/storybook*
web/public
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tmp
api/types/*
web/playwright-report/*
web/types/*
web/public/*
.github
.yarn
./index.js
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ yarn rw dev
---

### Testing


```terminal
# both api and web
yarn test
Expand All @@ -44,6 +46,20 @@ yarn test:nowatch
yarn test:e2e
```

### Storybook

the config files are located in web/config/storybok*
when reading the [storybook docs](https://storybook.js.org/docs/react/get-started/introduction) they will reference config files not found in this project. The list below provides the interface for these. Note: these configs will override any defaults that redwood has set. You can read more [here](https://redwoodjs.com/docs/storybook#getting-started-with-storybook)

- storybook.config.js -> main.js
- storybook.manager.js -> manager.js
- storybook.preview.js -> preview.js

```terminal
# for development run without a cache
yarn rw storybook --no-manager-cache
```

---

### Notes
Expand Down
8 changes: 5 additions & 3 deletions api/src/functions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ export const handler = async (event, context) => {
data: {
username: username,
email: userAttributes.email,
hashedPassword: hashedPassword,
salt: salt,
hashedPassword,
salt,
verifyToken: randomUUID(),
},
})
Expand Down Expand Up @@ -158,7 +158,7 @@ export const handler = async (event, context) => {

const authHandler = new DbAuthHandler(event, context, {
// Provide prisma db client
db: db,
db,

// The name of the property you'd call on `db` to access your user table.
// i.e. if your Prisma model is named `User` this value would be `user`, as in `db.user`
Expand All @@ -170,6 +170,8 @@ export const handler = async (event, context) => {
authFields: {
id: 'id',
username: 'username',
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
email: 'email',
hashedPassword: 'hashedPassword',
salt: 'salt',
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@
"lint": "yarn eslint && yarn pretty",
"eslint": "npx eslint .",
"pretty": "npx prettier --check .",
"dev": "./scripts/dev.sh",
"playwright": "npx playwright test -c web/playwright.config.ts --debug",
"test:e2e": "./scripts/e2e.ts",
"pretty:fix": "npx prettier -c -w .",
"dev": "scripts/dev.sh",
"storybook": "yarn rw storybook",
"storybook:nocache": "yarn storybook --no-manager-cache",
"test": "yarn rw test",
"test:e2e": "./scripts/e2e.ts",
"schema:format": "npx prisma format",
"db:setup": "yarn rw prisma migrate dev && yarn rw prisma db seed"
},
Expand Down
7 changes: 7 additions & 0 deletions web/config/storybook.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// merges with storybook main.js
module.exports = {
/**
* @see {@link https://storybook.js.org/addons/tag/essentials}
*/
addons: ['@storybook/addon-essentials'],
}
6 changes: 6 additions & 0 deletions web/config/storybook.manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/addons'
import { themes } from '@storybook/theming'

addons.setConfig({
theme: themes.dark,
})
2 changes: 0 additions & 2 deletions web/config/storybook.preview.js

This file was deleted.

9 changes: 9 additions & 0 deletions web/config/storybook.preview.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import '../src/index.css'

export const decorators = [
(Story) => (
<div style={{ margin: '1em' }}>
<Story />
</div>
),
]
13 changes: 12 additions & 1 deletion web/config/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
module.exports = {
content: ['src/**/*.{js,jsx,ts,tsx}'],
theme: {
fontSize: {
xs: '0.6rem',
sm: '0.8rem',
base: '1rem',
xl: '1.25rem',
'2xl': '1.563rem',
'3xl': '1.953rem',
'4xl': '2.441rem',
'5xl': '3.052rem',
},
extend: {
backgroundImage: {
bg: "url('./images/bg.jpg')",
bg: "url('./assets/bg.jpg')",
},
backgroundSize: {
half: '50% 100%',
Expand All @@ -22,6 +32,7 @@ module.exports = {
eternity: '##2d2d2b', // almost black
sonicSilver: '#747474', // mid gray
},
spacing: {},
},
fontFamily: {
sans: ['Montserrat', 'sans-serif'],
Expand Down
2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
},
"devDependencies": {
"@playwright/test": "^1.29.1",
"@storybook/addons": "^6.5.15",
"@storybook/theming": "^6.5.15",
"@testing-library/user-event": "^14.4.3",
"@types/crypto-js": "^4.1.1",
"autoprefixer": "^10.4.13",
Expand Down
1 change: 0 additions & 1 deletion web/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const BROWSERS_TO_RUN = process.env.BROWSERS?.split(',')
const config: PlaywrightTestConfig = {
globalSetup: require.resolve('./playwright.setup.ts'),
testDir: './tests',

fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
Expand Down
18 changes: 16 additions & 2 deletions web/playwright.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ async function globalSetup() {
const adminLogin = await browser.newPage()
await adminLogin.goto(`${BASE_URL}/login`)

const usernameInput = adminLogin.getByLabel('username')
const usernameInput = adminLogin.getByRole('textbox', { name: 'Username' })
await usernameInput.click()
await usernameInput.fill('admin')

const passwordInput = adminLogin.getByLabel('password')
const passwordInput = adminLogin.getByRole('textbox', { name: 'Password' })
await passwordInput.click()
await passwordInput.fill('password')

await adminLogin.getByRole('button', { name: 'Login' }).click()
await adminLogin.waitForURL(BASE_URL, { waitUntil: 'domcontentloaded' })
await adminLogin.getByRole('button', { name: 'Log in' }).click()
await adminLogin.waitForURL(BASE_URL, { waitUntil: 'domcontentloaded' })

await adminLogin
.context()
Expand All @@ -31,6 +33,18 @@ async function globalSetup() {
await userLogin.locator('input[name="password"]').fill('password')
await userLogin.getByRole('button', { name: 'Login' }).click()
await userLogin.waitForURL(BASE_URL, { waitUntil: 'domcontentloaded' })
const usersUserInput = userLogin.getByRole('textbox', { name: 'Username' })
await usersUserInput.click()
await usersUserInput.fill('user')

const usersPasswordInput = userLogin.getByRole('textbox', {
name: 'Password',
})
await usersPasswordInput.click()
await usersPasswordInput.fill('password')

await userLogin.getByRole('button', { name: 'Log in' }).click()
await userLogin.waitForURL(BASE_URL, { waitUntil: 'domcontentloaded' })

await userLogin
.context()
Expand Down
1 change: 1 addition & 0 deletions web/public/assets/ZealLogoAlt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FatalErrorBoundary, RedwoodProvider } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'
import { Toaster } from '@redwoodjs/web/dist/toast'

import FatalErrorPage from 'src/pages/FatalErrorPage'
import Routes from 'src/Routes'
Expand All @@ -14,6 +15,7 @@ const App = () => (
<RedwoodProvider titleTemplate="%PageTitle | %AppTitle">
<AuthProvider>
<RedwoodApolloProvider useAuth={useAuth}>
<Toaster toastOptions={{ className: 'bg-white', duration: 6000 }} />
<Routes />
</RedwoodApolloProvider>
</AuthProvider>
Expand Down
2 changes: 1 addition & 1 deletion web/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AdminLayout } from './layouts/Admin/AdminLayout'
import { RolesLayout } from './layouts/Admin/RolesLayout'
import { TeamsLayout } from './layouts/Admin/TeamsLayout'
import { UsersLayout } from './layouts/Admin/UsersLayout'
import { MainLayout } from './layouts/MainLayout/MainLayout'
import { MainLayout } from './layouts/MainLayout'
import { ProfileLayout } from './layouts/ProfileLayout'

const Routes = () => {
Expand Down
Binary file added web/src/assets/bg-clip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/assets/bg-search.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
1 change: 1 addition & 0 deletions web/src/assets/bw-zeal-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions web/src/assets/ipad-bg-ayer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1405af7

Please sign in to comment.