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

feat(admin-ui): added possibility to add draws, minor text color chan… #100

Open
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

KristofferMarthinsen
Copy link

i did stuff

kabinizer-front-end/src/pages/admin/index.tsx Outdated Show resolved Hide resolved
kabinizer-front-end/src/pages/admin/index.tsx Outdated Show resolved Hide resolved
kabinizer-front-end/src/pages/admin/index.tsx Outdated Show resolved Hide resolved
kabinizer-front-end/src/pages/admin/index.tsx Outdated Show resolved Hide resolved
kabinizer-front-end/src/pages/admin/index.tsx Outdated Show resolved Hide resolved
@@ -19,7 +19,7 @@ const Welcome = () => {
<h1 className="text-3xl font-bold tracking-tighter md:text-5xl">
Velkommen til Tjørhomfjellet
</h1>
<p className="max-w-[600px] text-gray-500 dark:text-gray-400 md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
<p className="max-w-[600px] text-gray-100 dark:text-gray-100 md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to list it twice if it is the same color in light and dark mode.

Comment on lines 92 to 102
<label className="w-32 rounded bg-[#354A71] p-1 text-center">
Deadline from
</label>
<input
className="w-56 rounded bg-white p-1 text-justify text-black"
type="date"
value={draw?.deadlineStart}
name="deadlineStart"
id="deadlineStart"
onChange={handleChangePeriod}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing the deadline from field from the UI. Set it to the current day.

At least, let's give it a name that fits better, like open for booking or something.

Comment on lines 20 to 21
[e.target.name]: e.target.value,
isSpecial,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially setting isSpecial twice?

<label className="w-full rounded bg-[#354A71] p-1 text-center">
<hr />
</label>
{draw?.drawPeriods?.map((date, key) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the name index instead of key.

Comment on lines 36 to 74
const addToDrawPeriods = (e, key) => {
const { name, value } = e.target;
const addTextToPeriodDraw = draw?.drawPeriods?.map((date, index) => {
if (index === key) {
return {
...date,
[name]: value,
};
}
return date;
}, []);
setDraw({
...draw,
drawPeriods: addTextToPeriodDraw,
});
};

const addTitleToDrawPeriods = (value: string, key: number) => {
const addTextToPeriodDraw = draw?.drawPeriods?.map((date, index) => {
if (index === key) {
return {
...date,
title: value,
};
}
return date;
}, []);
setDraw({
...draw,
drawPeriods: addTextToPeriodDraw,
});
};

const addDrawPeriods = () => {
setDraw({
...draw,
drawPeriods: [...draw.drawPeriods, { start: "", end: "", title: "" }],
});
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could simplify the state-getting and setting logic. But we can refactor it later.

import { useState } from "react";
import { DrawService } from "../../api/services/DrawService";

const NewPeriodView = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider showing this as its own page.
Also, think about combining creating and editing of a draw as one page. - the logic should be quite similar for both operations

Copy link
Collaborator

@SjoenH SjoenH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet-format is now part of the .NET 6 SDK. Invoking the dotnet format command will fix whitespace, code style, and analyzer issues by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants