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

Editable Settings #129

Merged
merged 83 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
10a6ad9
1337 code my dude
brekk Dec 8, 2021
32958f9
rebase fixery
brekk Jan 5, 2022
28286ca
add CODEOWNERS
brekk Jan 5, 2022
0dfff16
reloaded
brekk Jan 5, 2022
700e889
try this
brekk Jan 5, 2022
1985f7b
oof too much
brekk Jan 6, 2022
857aba6
dammit
brekk Jan 6, 2022
814d511
damn mocking fetch is hard
brekk Jan 7, 2022
42b3a11
remove tests from this PR
brekk Jan 7, 2022
79c6d95
force vercel to rebuild
brekk Jan 7, 2022
0a7b3db
fix this part
brekk Jan 10, 2022
e1c04e8
home stretch
brekk Jan 10, 2022
100e21f
compare correctly
brekk Jan 10, 2022
7ccf6fb
add this
brekk Jan 10, 2022
c8d7148
smash those useEffects together
brekk Jan 10, 2022
86a7173
more testing
brekk Jan 10, 2022
1322e0b
too much too many too tired
brekk Jan 10, 2022
e5477d6
knife
brekk Jan 10, 2022
d04d445
too many
brekk Jan 10, 2022
1a9b18b
this breaks things, but committing for posterity
brekk Jan 10, 2022
d8305ed
try this before we sleep
brekk Jan 11, 2022
3c80430
try again
brekk Jan 11, 2022
add0ee9
email is always valid
brekk Jan 11, 2022
ca39f90
this direction
brekk Jan 11, 2022
7cd57f3
update
brekk Jan 12, 2022
e70a9ae
this?
brekk Jan 12, 2022
7868589
hard to test this locally
brekk Jan 12, 2022
01fce69
remove logs
brekk Jan 12, 2022
201f83b
address some feedback
brekk Jan 19, 2022
3ce1077
investigate 'placeholder' attribute
brekk Jan 19, 2022
7f4f86c
fix placeholder and loading status
brekk Jan 19, 2022
85a450e
log more & test
brekk Jan 19, 2022
c78ff91
more debuggery
brekk Jan 19, 2022
caf622e
Remove $toast from user details useEffect
dguenther Jan 20, 2022
06e3cb7
undo the serverside shiz
brekk Jan 20, 2022
4d77b9f
fetch hook staging test
brekk Jan 21, 2022
4765ac6
thread setUser
brekk Jan 21, 2022
f0dbe37
try with setFetch on
brekk Jan 21, 2022
0676eee
do it again
brekk Jan 21, 2022
bf0efed
trace more
brekk Jan 21, 2022
5e06c0f
drill drill drill
brekk Jan 21, 2022
5b8eff9
refresh yo'self
brekk Jan 21, 2022
6ba6fbf
change ordering
brekk Jan 24, 2022
271ea5e
more
brekk Jan 24, 2022
e5cd6aa
try this
brekk Jan 24, 2022
f541f78
account for spontaneous logout
brekk Jan 24, 2022
bf8e8d0
try this on staging
brekk Jan 24, 2022
f701e34
try this on staging
brekk Jan 24, 2022
6baa677
try this on staging
brekk Jan 24, 2022
7945ba5
more more chore bore
brekk Jan 24, 2022
cb2b872
log more
brekk Jan 24, 2022
5938f2f
more mor emore
brekk Jan 25, 2022
2ff376e
more more more more moremore
brekk Jan 25, 2022
034bdc7
remove extra level
brekk Jan 25, 2022
27d15db
dedicated logging
brekk Jan 25, 2022
23d9393
log more
brekk Jan 25, 2022
627a209
more more more more more more
brekk Jan 25, 2022
50cdf6f
more logging
brekk Jan 25, 2022
c674b2c
log hog
brekk Jan 25, 2022
60d9928
more logging
brekk Jan 25, 2022
e1e9b6f
update
brekk Jan 25, 2022
587a3be
more logging
brekk Jan 25, 2022
e273c5d
:hocho:
brekk Jan 25, 2022
c3a6498
we'll chase this damn rabbit
brekk Jan 26, 2022
20819b0
more, more, more moooooore
brekk Jan 26, 2022
65e78b2
nice
brekk Jan 26, 2022
da6ff03
more
brekk Jan 26, 2022
3b8146c
bill o'reilly
brekk Jan 26, 2022
12478d1
insanity
brekk Jan 26, 2022
71802e8
more more ship more
brekk Jan 26, 2022
f805935
more more bore chore
brekk Jan 26, 2022
f8a145a
more more bore chore
brekk Jan 26, 2022
690cb70
control patrol
brekk Jan 26, 2022
206b396
remove some logs
brekk Jan 26, 2022
247562b
remove UI logs
brekk Jan 26, 2022
fe6cca5
log errors
brekk Jan 27, 2022
fbeb68f
more more more more
brekk Jan 27, 2022
893acbe
{code, message} errors
brekk Jan 27, 2022
29b3cec
cleanups
brekk Jan 27, 2022
a11ed65
fix integration
brekk Jan 27, 2022
16cec48
actually fix integration
brekk Jan 27, 2022
bdb813b
flippy floppy
brekk Jan 31, 2022
ddb88b5
elvis is coersive
brekk Jan 31, 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @iron-fish/frontend
dguenther marked this conversation as resolved.
Show resolved Hide resolved
29 changes: 24 additions & 5 deletions apiClient/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@ import {

// Environment variables set in Vercel config.
const SERVER_API_URL = process.env.API_URL
const SERVER_API_KEY = process.env.API_KEY
const BROWSER_API_URL = process.env.NEXT_PUBLIC_API_URL
const BROWSER_API_KEY = process.env.NEXT_PUBLIC_API_KEY

const API_URL = SERVER_API_URL || BROWSER_API_URL
const API_KEY = SERVER_API_KEY || BROWSER_API_KEY
dguenther marked this conversation as resolved.
Show resolved Hide resolved
export const API_URL = SERVER_API_URL || BROWSER_API_URL

export async function createUser(
email: string,
Expand All @@ -43,13 +40,35 @@ export async function createUser(
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${API_KEY}`,
},
body,
})
return await res.json()
}

type PartialUser = {
email?: string
graffiti?: string
socialChoice?: string
social?: string
countryCode?: string
}

export async function updateUser(id: number, partial: PartialUser) {
const body = JSON.stringify(partial)
const token = await magic?.user.getIdToken()
const options = {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
body,
}
const res = await fetch(`${API_URL}/users/${id}`, options)
return await res.json()
}

export async function listLeaderboard({
search,
country_code: countryCode,
Expand Down
4 changes: 3 additions & 1 deletion components/About/CallToAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ export const CallToAction = ({
className="m-auto w-full mt-2 max-w-md mb-2 text-md p-2"
colorClassName="text-black bg-transparent hover:bg-black hover:text-white"
>
{href ? <Link href={href}>Claim Points</Link> : ctaText}
<Link href={'https://forms.gle/yrAtzoyKTwLgLTRZA'}>
Claim Points
</Link>
</RawButton>
</Link>
)}
Expand Down
4 changes: 2 additions & 2 deletions components/Form/Select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
width: 1rem;
height: 2rem;
text-align: center;
background-image: url(public/arrow_drop_down_black.png);
background-image: url(/arrow_drop_down_black.png);
background-repeat: no-repeat;
background-position: center center;
background-color: transparent;
pointer-events: none;
}

.customSelectWrapper.disabled::after {
background-image: url(public/arrow_drop_down_disabled.png);
background-image: url(/arrow_drop_down_disabled.png);
}
35 changes: 23 additions & 12 deletions components/Form/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const RadioOptions = ({
</div>
)

export interface ControlledField extends Field {
controlled?: boolean
}

export const TextField = ({
id,
label,
Expand All @@ -63,9 +67,25 @@ export const TextField = ({
setChoice,
isRadioed,
disabled,
required = true,
whitespace = WHITESPACE.DEFAULT,
}: Field) => {
value,
controlled = false,
}: ControlledField) => {
const handleTrim = whitespace !== WHITESPACE.DEFAULT ? { onKeyDown } : {}
const controller = controlled ? { value: value } : {}
const inputProps = {
...handleTrim,
...controller,
className: `${disabled ? 'bg-transparent' : ''}`,
defaultValue,
disabled,
onBlur,
onChange,
id,
type: 'text',
placeholder,
}
return (
<LabelledRow
key={id}
Expand All @@ -74,6 +94,7 @@ export const TextField = ({
valid={valid}
errorText={errorText}
disabled={disabled}
required={required}
>
{isRadioed && options.length > 0 && (
<RadioOptions
Expand All @@ -84,17 +105,7 @@ export const TextField = ({
setChoice={setChoice}
/>
)}
<input
className={`${disabled ? 'bg-transparent' : ''}`}
defaultValue={defaultValue}
disabled={disabled}
onBlur={onBlur}
onChange={onChange}
{...handleTrim}
id={id}
type="text"
placeholder={placeholder}
/>
<input {...inputProps} />
</LabelledRow>
)
}
Expand Down
Loading