Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(site): replace UserContext with userXService #465

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

Merged
merged 48 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e620598
Install and configure XState
presleyp Mar 15, 2022
c3a143b
userXService - typegen not working yet
presleyp Mar 15, 2022
561cd6b
Lint, fix error transitions
presleyp Mar 15, 2022
1548fb8
Lint
presleyp Mar 15, 2022
80e10c8
Change initial state to handle loss of state
presleyp Mar 15, 2022
3daf0a9
Fix gitignore
presleyp Mar 15, 2022
9f65327
Fix types by hook or by crook
presleyp Mar 15, 2022
d6bd5f6
Use xservice in all pages
presleyp Mar 15, 2022
242cb61
Merge branch 'main' into 435/presleyp/user-state
presleyp Mar 16, 2022
1e07da7
Glue/visual component separation
presleyp Mar 16, 2022
16692da
Fix dependency merge
presleyp Mar 16, 2022
d1017f0
Lint
presleyp Mar 16, 2022
85779b9
Remove UserContext
presleyp Mar 16, 2022
f82b099
Remove inspector
presleyp Mar 16, 2022
d4d79ea
Add typegen command to site/out
bryphe-coder Mar 16, 2022
ca2fc53
Merge branch '435/presleyp/user-state' of github.com:coder/coder into…
bryphe-coder Mar 16, 2022
17db4a9
Fix index page redirects
presleyp Mar 16, 2022
aa5441d
Merge branch '435/presleyp/user-state' of github.com:coder/coder into…
presleyp Mar 16, 2022
8d3f051
DRY up nav and redirects
presleyp Mar 16, 2022
d98c8c7
Merge branch 'main' into 435/presleyp/user-state
presleyp Mar 16, 2022
e5fd635
Moves based on merge
presleyp Mar 16, 2022
9ef9dca
Moving Page helpers into Page dir
presleyp Mar 16, 2022
97d94de
Move xservice into src, update script
presleyp Mar 16, 2022
9c21d4f
Move and storybook navbarview
presleyp Mar 16, 2022
d1b1bab
Update docs
presleyp Mar 16, 2022
e6a7895
Install MSW
presleyp Mar 16, 2022
6ac0530
Reorganization, with apologies
presleyp Mar 16, 2022
1c54f80
Missed spots
presleyp Mar 16, 2022
ee8ff32
Add mock handlers
presleyp Mar 16, 2022
a88e260
Configure jest for msw
presleyp Mar 17, 2022
e0e36a0
Fix typos
presleyp Mar 17, 2022
cf7f934
Shift unit test to NavbarView
presleyp Mar 17, 2022
ca3e7fc
Fix test types
presleyp Mar 17, 2022
6700453
Rename NavbarView test
presleyp Mar 17, 2022
48ac5b7
Attempt at test, wip
presleyp Mar 17, 2022
5c142db
Fix config
presleyp Mar 17, 2022
595859a
Be logged out, only warn
presleyp Mar 17, 2022
1824877
Conditionally show text to help test
presleyp Mar 17, 2022
f3902a1
Use a Context for MSW's sake
presleyp Mar 18, 2022
219bc44
mocks -> test_helpers
presleyp Mar 18, 2022
9d638ee
Enable dev tools
presleyp Mar 18, 2022
b4bb44e
Format
presleyp Mar 18, 2022
9c40fc5
Fix import
presleyp Mar 18, 2022
46e3888
Merge branch 'main' into 435/presleyp/user-state
presleyp Mar 18, 2022
e0f4d7a
Fixes
presleyp Mar 18, 2022
5a0f9ac
Merge branch 'main' into 435/presleyp/user-state
presleyp Mar 18, 2022
42f0554
Lint
presleyp Mar 18, 2022
2be726b
run typegen postinstall
presleyp Mar 18, 2022
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
Prev Previous commit
Next Next commit
Move xservice into src, update script
  • Loading branch information
presleyp committed Mar 16, 2022
commit 97d94de54d942b0ebb59659861e9754ba63f1b7b
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"storybook:build": "build-storybook",
"test": "jest --selectProjects test",
"test:coverage": "jest --selectProjects test --collectCoverage",
"typegen": "xstate typegen '**/*.ts'"
"typegen": "xstate typegen 'src/**/*.ts'"
},
"dependencies": {
"@material-ui/core": "4.9.4",
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Logo } from "../Icons"
import { UserDropdown } from "./UserDropdown"
import { UserResponse } from "../../api"
import { useActor } from "@xstate/react"
import { userXService } from "../../../xServices/user/userXService"
import { userXService } from "../../xServices/user/userXService"

export interface NavbarProps {
user?: UserResponse
Expand Down
2 changes: 1 addition & 1 deletion site/src/components/Page/RequireAuth.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useActor } from "@xstate/react"
import React from "react"
import { Navigate, useLocation } from "react-router"
import { userXService } from "../../../xServices/user/userXService"
import { userXService } from "../../xServices/user/userXService"
import { FullScreenLoader } from "../Loader/FullScreenLoader"

export interface RequireAuthProps {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from "react"
import { SignInForm } from "./../components/SignIn"
import { Navigate, useLocation } from "react-router-dom"
import { Location } from "history"
import { userXService } from "../../xServices/user/userXService"
import { userXService } from "../xServices/user/userXService"

export const useStyles = makeStyles((theme) => ({
root: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { createMachine, interpret, assign } from "xstate"
import { UserResponse } from "../../api"
import * as API from "../../api"
import * as API from '../../api'

export interface UserContext {
getUserError?: Error | unknown // unknown is a concession while I work out typing issues
authError?: Error | unknown
me?: UserResponse
me?: API.UserResponse
}

export type UserEvent = { type: "SIGN_OUT" } | { type: "SIGN_IN"; email: string; password: string }
Expand Down