-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(edit): settings in one form #1823
base: main
Are you sure you want to change the base?
Conversation
tavla/app/(admin)/edit/[id]/components/MetaSettings/Organization.tsx
Outdated
Show resolved
Hide resolved
@@ -78,7 +78,7 @@ function CompressSurvey() { | |||
|
|||
return ( | |||
<> | |||
<div className="box flex flex-col"> | |||
<div className="box flex flex-col w-1/2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synes denne ser litt rar ut 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤷♂️
'use client' | ||
import { Heading4 } from '@entur/typography' | ||
import { TFontSize } from 'types/meta' | ||
import { TBoardID } from 'types/settings' | ||
import { FontChoiceChip } from './FontChoiceChip' | ||
|
||
function FontSelect({ font }: { bid: TBoardID; font: TFontSize }) { | ||
return ( | ||
<div> | ||
<Heading4 margin="bottom">Tekststørrelse </Heading4> | ||
<FontChoiceChip font={font} /> | ||
</div> | ||
) | ||
} | ||
|
||
export { FontSelect } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trenger denne å være en egen komponent lenger? Man kan vel bare ta Headingen inn i FontChoiceChip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await firestore() | ||
.collection(fromOrg ? 'organizations' : 'users') | ||
.doc((fromOrg || user?.uid) ?? '') | ||
.update({ | ||
[fromOrg ? 'boards' : 'owner']: | ||
firestore.FieldValue.arrayRemove(bid), | ||
}) | ||
|
||
await firestore() | ||
.collection(personal || !organization ? 'users' : 'organizations') | ||
.doc((personal || !organization ? user?.uid : organization) ?? '') | ||
.update({ | ||
[personal || !organization ? 'owner' : 'boards']: | ||
firestore.FieldValue.arrayUnion(bid), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kan dette gjøres mer lesbart? Kanskje verdt det å kjøre en if-løkke rundt for å sjekke om boardet tilhører organisasjon eller ikke
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gjenbruker nå tidligere moveboard
funksjon
const errors = await saveForm(data, selectedPoint?.value as TLocation) | ||
|
||
if (!errors) { | ||
setFormErrors({}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trengs denne? er ikke errors tom fra før av?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Måtte gjøre det for å håndtere når man allerede har en form error og fikser på de, ellers blir ikke tidligere feil borte
const organization = | ||
organizationString === 'undefined' ? undefined : organizationString |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hva skjer her? kanskje legg inni if-løkke for økt lesbarhet
value: data.get('viewType') as string, | ||
}) | ||
|
||
const errors = await saveForm(data, selectedPoint?.value as TLocation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hvorfor legges organization til med data.append, mens location sendes inn som eget argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fikset på det, org sendes inn som de andre innstillingene. Location må derimot sendes inn på denne måten pga nested object
Bug: å fjerne adresse-feltet fjerner ikke lenger gåavstand på tiles |
onChange={() => setOverride(!override)} | ||
name="override" | ||
> | ||
Vis organisasjons infomelding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vis infomelding fra organisasjonen.
|
||
return ( | ||
<div> | ||
<Heading4 margin="bottom">Organisasjon</Heading4> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obs: husk at i dev og prod nå er organisasjon byttet ut med tavler overalt, så vi må ikke introdusere "organisasjon" noe sted igjen
<Heading4 margin="bottom">Gangavstand</Heading4> | ||
<Paragraph className="mb-2"> | ||
Vis gåavstanden fra tavlens adresse til stoppestedet. | ||
</Paragraph> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Gangavstand" begge steder, ikke gåavstand
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
og denne teksten skal være: "Om du legger inn tavlens adresse, vises gangavstanden fra tavlen
til hvert stoppested."
Rettelse: oppdatering av gangavstand generelt har sluttet å virke. Det skjer ingenting når jeg skriver inn en ny adresse. |
Avbryt-knappen gjør ingenting. Bør ikke den sette innstillingene tilbake til slik de var? Eller evt først trigge popup som sier at du har ulagrede endringer? |
1440683
to
eae6faa
Compare
En lagreknapp for tavleinnstillinger
Motivasjon
Ny layout på edit siden
Endringer
Settings
som har alle innstillinger. Her skjer submit eventet med evt error handling, som sendes til hver komponentSjekkliste for Review