Skip to content

Commit

Permalink
Merge pull request #718 from openstad/develop
Browse files Browse the repository at this point in the history
Update main with develop changes
  • Loading branch information
iandebruin98 authored Jan 23, 2025
2 parents 0cfcb42 + 6fdc57f commit e9fa8f6
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 29 deletions.
60 changes: 36 additions & 24 deletions apps/admin-server/src/pages/projects/[project]/settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const formSchema = z.object({
message: 'De URL mag alleen kleine letters, cijfers, punten, dubbele punten, koppeltekens, onderstrepingstekens en schuine strepen bevatten.'
}).optional(),
basicAuthActive: z.coerce.boolean().optional(),
projectToggle: z.boolean().optional(),
});


Expand All @@ -62,17 +63,17 @@ export default function ProjectSettings() {
() => {
const currentDate = new Date();


return {
name: data?.name || '',
endDate: data?.config?.project?.endDate
? new Date(data?.config?.project?.endDate)
: new Date(currentDate.getFullYear(), currentDate.getMonth() + 3),
url: data?.url || '',
basicAuthActive: data?.config?.basicAuth?.active || false,
username: data?.config?.basicAuth?.username || '',
password: data?.config?.basicAuth?.password || '',
}
name: data?.name || '',
endDate: data?.config?.project?.endDate
? new Date(data?.config?.project?.endDate)
: new Date(currentDate.getFullYear(), currentDate.getMonth() + 3),
url: data?.url || '',
basicAuthActive: data?.config?.basicAuth?.active || false,
username: data?.config?.basicAuth?.username || '',
password: data?.config?.basicAuth?.password || '',
projectToggle: data?.config?.project?.projectToggle || false,
}
},
[data]
);
Expand All @@ -91,6 +92,7 @@ export default function ProjectSettings() {
useEffect(() => {
if (checkboxInitial) {
if (data?.url) {
form.setValue('projectToggle', true);
setShowUrl(true)
setCheckboxInitial(false)
}
Expand All @@ -108,7 +110,8 @@ export default function ProjectSettings() {
const project = await updateProject(
{
project: {
endDate: values.endDate
endDate: values.endDate,
projectToggle: values.projectToggle,
},
basicAuth: {
active: values.basicAuthActive,
Expand Down Expand Up @@ -269,19 +272,28 @@ export default function ProjectSettings() {
fieldInfo="Na deze datum is het automatisch niet meer mogelijk om plannen in te dienen, reacties te plaatsen en te stemmen."
/>

<div>
<FormLabel>
Wil je een website voor dit project?
</FormLabel>
<Switch.Root
className="block w-[50px] h-[25px] bg-stone-300 rounded-full relative focus:shadow-[0_0_0_2px] focus:shadow-black data-[state=checked]:bg-primary outline-none cursor-default mt-2"
onCheckedChange={(e: boolean) => {
setShowUrl(!showUrl)
}}
checked={showUrl}>
<Switch.Thumb className="block w-[21px] h-[21px] bg-white rounded-full transition-transform duration-100 translate-x-0.5 will-change-transform data-[state=checked]:translate-x-[27px]" />
</Switch.Root>
</div>
<FormField
control={form.control}
name="projectToggle"
render={({ field }) => (
<FormItem className="col-span-1">
<FormLabel>
Wil je een website voor dit project?
</FormLabel>
<Switch.Root
className="block w-[50px] h-[25px] bg-stone-300 rounded-full relative focus:shadow-[0_0_0_2px] focus:shadow-black data-[state=checked]:bg-primary outline-none cursor-default"
onCheckedChange={(e: boolean) => {
field.onChange(e);
setShowUrl(!showUrl)
}}
checked={field.value}>
<Switch.Thumb className="block w-[21px] h-[21px] bg-white rounded-full transition-transform duration-100 translate-x-0.5 will-change-transform data-[state=checked]:translate-x-[27px]" />
</Switch.Root>
<FormMessage />
</FormItem>
)}
/>

{showUrl ? (
<FormField
control={form.control}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
admin:
deploymentContainer:
image: ghcr.io/openstad/admin-server:develop-2b62eb1
image: ghcr.io/openstad/admin-server:develop-5cd8e51
api:
deploymentContainer:
image: ghcr.io/openstad/api-server:develop-2b62eb1
image: ghcr.io/openstad/api-server:develop-5cd8e51
auth:
deploymentContainer:
image: ghcr.io/openstad/auth-server:develop-2b62eb1
image: ghcr.io/openstad/auth-server:develop-5cd8e51
image:
deploymentContainer:
image: ghcr.io/openstad/image-server:develop-2b62eb1
image: ghcr.io/openstad/image-server:develop-5cd8e51
cms:
deploymentContainer:
image: ghcr.io/openstad/cms-server:develop-2b62eb1
image: ghcr.io/openstad/cms-server:develop-5cd8e51

0 comments on commit e9fa8f6

Please sign in to comment.