Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:chingu-x/chingu-dashboard into refac…
Browse files Browse the repository at this point in the history
…tor/hexagonal-pattern-poc-v2
  • Loading branch information
Dan-Y-Ko committed Oct 1, 2024
2 parents eaa93a9 + 2169bc2 commit 2f622a6
Show file tree
Hide file tree
Showing 37 changed files with 326 additions and 140 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/).


## [1.0.0-alpha.6] - 2024-09-27

### Added
- Added po and sm forms for the weekly checkin for the appropriate teams https://github.com/chingu-x/chingu-dashboard/issues/216

### Changed
- Changed how we're accessing meeting data to match changes in backend https://github.com/chingu-x/chingu-dashboard/pull/269
- Updated dropdown menu in top nav https://github.com/chingu-x/chingu-dashboard/issues/261


### Fixed

## [1.0.0-alpha.5] - 2024-09-19

### Added


### Changed
- Made meeting link optional https://github.com/chingu-x/chingu-dashboard/issues/237

## [1.0.0-alpha.4] - 2024-09-10

### Added


### Changed
- Updated how we're retrieving the discord id to display in the directory page https://github.com/chingu-x/chingu-dashboard/issues/202


### Fixed
- Fixed issue with dark mode images being different size https://github.com/chingu-x/chingu-dashboard/issues/200
- Fixed issue with meeting notes section becoming scrollable instead of expanding when saved https://github.com/chingu-x/chingu-dashboard/issues/248


## [1.0.0-alpha.3] - 2024-09-05

### Added
- Added 404 page https://github.com/chingu-x/chingu-dashboard/issues/205

### Changed
- Updated top nav and side bar colors along with some other styling changes https://github.com/chingu-x/chingu-dashboard/issues/197

### Fixed
- Fixed active states in the sidebar https://github.com/chingu-x/chingu-dashboard/issues/198
- Fixed spacing issues in the calendar title with longer months wrapping to a newline https://github.com/chingu-x/chingu-dashboard/issues/201
- Fixed spacing issues in resources page https://github.com/chingu-x/chingu-dashboard/issues/206
- Fixed overflow issue with features description in the list https://github.com/chingu-x/chingu-dashboard/issues/222
- Fixed an issue with selecting team members in checkboxes https://github.com/chingu-x/chingu-dashboard/issues/230

## [1.0.0-alpha.2] - 2024-08-28

### Added
Expand Down
Binary file modified public/img/empty_ideation_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/empty_ideation_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/empty_resources_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/img/empty_resources_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/error_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/error_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const getDashboardData = async (
.map((sprint) =>
fetchMeeting({
sprintNumber: sprint.number,
meetingId: sprint.teamMeetings[0]?.id,
meetingId: sprint.teamMeetings[0],
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ export async function fetchTeamDirectory({

if (res) {
updateDirectoryWithCurrentTime(res);
const teamMember = res.voyageTeamMembers;
const elementToSort = teamMember.find(
(element) => element.member.discordId === user?.discordId,
const teamMembers = res.voyageTeamMembers;
const userDiscordId = user?.oAuthProfiles.find(
(profile) => profile.provider.name === "discord",
)?.providerUsername;
const elementToSort = teamMembers.find(
(element) =>
element.member.oAuthProfiles.find(
(profile) => profile.provider.name === "discord",
)?.providerUsername === userDiscordId,
);
moveElementToFirst(teamMember, elementToSort);

moveElementToFirst(teamMembers, elementToSort);
}

return [res, error];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ interface TeamMemberProps {

export default function TeamMember({ teamMember }: TeamMemberProps) {
const user = useUser().voyageTeamMembers;
const { firstName, lastName, discordId, currentTime } = teamMember.member;
const { firstName, lastName, oAuthProfiles, currentTime } = teamMember.member;
const { id, hrPerSprint, voyageRole } = teamMember;
const isCurrentUser = user.some((user) => user.id === id);
const [isEditing, setIsEditing] = useState<boolean>(false);
const newRef = useRef<HTMLDivElement>(null);

const discordId =
oAuthProfiles.find((profile) => profile.provider.name === "discord")
?.providerUsername || "";

useEffect(() => {
document.addEventListener("mousedown", handleOutsideClick);
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import ErrorComponent from "@/components/Error";
function getMeeting(sprints: Sprint[], sprintNumber: number) {
const sprint = sprints.find((sprint) => sprint.number === sprintNumber);

if (sprint?.teamMeetings && sprint?.teamMeetings.length > 0)
return sprint.teamMeetings[0];
if (sprint?.teamMeetingsData && sprint?.teamMeetingsData.length > 0)
return sprint.teamMeetingsData[0];
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function ProgressStepper({

function handleClick(sprintNumber: number) {
const meetingId = sprints.find((sprint) => sprint.number === sprintNumber)!
.teamMeetings[0]?.id;
.teamMeetings[0];

if (meetingId) {
router.push(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default async function RedirectToCurrentSprintWrapper({
const teamId = Number(params.teamId);

let currentSprintNumber: number;
let currentMeetingId: number;

const [user, error] = await getUser();

Expand Down Expand Up @@ -111,12 +110,12 @@ export default async function RedirectToCurrentSprintWrapper({
);
}
const { teamMeetings, number } = getCurrentSprint(res!.sprints) as Sprint;

currentSprintNumber = number;
currentMeetingId = teamMeetings[0]?.id;

if (currentMeetingId) {
if (teamMeetings.length !== 0) {
redirect(
`/my-voyage/${teamId}/sprints/${currentSprintNumber}/meeting/${currentMeetingId}`,
`/my-voyage/${teamId}/sprints/${currentSprintNumber}/meeting/${teamMeetings[0]}`,
);
} else {
redirect(`/my-voyage/${teamId}/sprints/${currentSprintNumber}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default async function SprintWrapper({ params }: SprintWrapperProps) {

const correspondingMeetingId = voyageData.sprints.find(
(sprint) => sprint.number === sprintNumber,
)?.teamMeetings[0]?.id;
)?.teamMeetings[0];

if (meetingId === correspondingMeetingId) {
const [res, error] = await fetchMeeting({ sprintNumber, meetingId });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { handleAsync } from "@/utils/handleAsync";
import { type AsyncActionResponse } from "@/utils/handleAsync";
import { getCurrentVoyageData } from "@/utils/getCurrentVoyageData";
import routePaths from "@/utils/routePaths";
import { Forms } from "@/utils/form/formsEnums";
import { Forms, UserRole } from "@/utils/form/formsEnums";
import { type Question, type TeamMemberForCheckbox } from "@/utils/form/types";
import { getSprintCheckinIsStatus } from "@/utils/getFormStatus";
import { getCurrentSprint } from "@/utils/getCurrentSprint";
Expand Down Expand Up @@ -76,6 +76,11 @@ export default async function WeeklyCheckInWrapper({
let description = "";
let questions = [] as Question[];

let hasProductOwner = false;
let hasScrumMaster = false;
let isScrumMaster = false;
let isProductOwner = false;

const [user, error] = await getUser();

const { errorResponse, data } = await getCurrentVoyageData({
Expand Down Expand Up @@ -142,6 +147,25 @@ export default async function WeeklyCheckInWrapper({
}).voyageTeamMemberId;
}

// Check if a team has a product owner or a scrum muster and if a user is a team has a product owner or a scrum muster
hasScrumMaster = !!res.voyageTeamMembers.find(
(member) =>
member.voyageRole.name === UserRole.scrumMaster.toString(),
);

hasProductOwner = !!res.voyageTeamMembers.find(
(member) =>
member.voyageRole.name === UserRole.productOwner.toString(),
);

const currentUserRole = res.voyageTeamMembers.find(
(member) => member.id === voyageTeamMemberId,
)?.voyageRole.name;

isScrumMaster = currentUserRole === UserRole.scrumMaster.toString();

isProductOwner = currentUserRole === UserRole.productOwner.toString();

// Get all teamMembers except for the current user
if (voyageTeamMemberId) {
teamMembers = res.voyageTeamMembers
Expand All @@ -164,7 +188,7 @@ export default async function WeeklyCheckInWrapper({
);
}

// Fetch form
// Fetch general checkin form
const [formRes, formError] = await fetchFormQuestions({
formId: Forms.checkIn,
});
Expand All @@ -177,8 +201,49 @@ export default async function WeeklyCheckInWrapper({
/>
);
}

if (formRes && formRes?.description) description = formRes.description;
if (formRes && formRes?.questions) questions = formRes.questions;

// Fetch PO checkin questions (form)
if (hasProductOwner && !isProductOwner) {
const [POformRes, POformError] = await fetchFormQuestions({
formId: Forms.checkinPO,
});

if (POformError) {
return (
<ErrorComponent
errorType={ErrorType.FETCH_FORM_QUESTIONS}
message={POformError.message}
/>
);
}

if (POformRes && POformRes?.questions)
questions = [...questions, ...POformRes.questions];
}

// Fetch SM checkin questions (form)
if (hasScrumMaster && !isScrumMaster) {
const [SMformRes, SMformError] = await fetchFormQuestions({
formId: Forms.checkinSM,
});

if (SMformError) {
return (
<ErrorComponent
errorType={ErrorType.FETCH_FORM_QUESTIONS}
message={SMformError.message}
/>
);
}

if (SMformRes && SMformRes?.questions)
questions = [...questions, ...SMformRes.questions];
}

questions = questions.sort((a, b) => a.order - b.order);
}
} else {
redirect(routePaths.dashboardPage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,13 @@ export default function AgendaTopicForm() {

useEffect(() => {
if (sprintNumber && agendaId) {
const topic = sprints
.find((sprint) => sprint.number === sprintNumber)
?.teamMeetings[0].agendas?.find((topic) => topic.id === agendaId);
const sprint = sprints.find((sprint) => sprint.number === sprintNumber);

const topic =
sprint?.teamMeetingsData &&
sprint.teamMeetingsData[0].agendas?.find(
(topic) => topic.id === agendaId,
);

setTopicData(topic);
setEditMode(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export default function MeetingForm() {
timezone,
}),
meetingLink: validateTextInput({
inputName: "Meeting Link",
required: true,
inputName: "Meeting link",
isUrl: true,
}),
});
Expand Down Expand Up @@ -117,9 +116,18 @@ export default function MeetingForm() {
timeZone: timezone,
});

const newData =
data.meetingLink === ""
? { description: data.description, title: data.title }
: {
description: data.description,
title: data.title,
meetingLink: data.meetingLink,
};

if (editMode) {
const [res, error] = await editMeetingAction({
...data,
...newData,
dateTime,
meetingId,
sprintNumber,
Expand All @@ -143,7 +151,7 @@ export default function MeetingForm() {
setEditMeetingLoading(false);
}
} else {
const payload = { ...data, dateTime, teamId, sprintNumber };
const payload = { ...newData, dateTime, teamId, sprintNumber };

const [res, error] = await addMeetingAction(payload);

Expand All @@ -169,8 +177,10 @@ export default function MeetingForm() {
useEffect(() => {
if (params.meetingId) {
const meeting = sprints.find(
(sprint) => sprint.teamMeetings[0]?.id === +params.meetingId,
)?.teamMeetings[0];
(sprint) =>
sprint.teamMeetingsData &&
sprint.teamMeetingsData[0].id === +params.meetingId,
);

setMeetingData(meeting as Meeting);
setEditMode(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function MeetingOverview({
className="w-full"
>
<Button
disabled={!meetingLink}
className="w-full justify-between bg-primary-content text-base-300 hover:text-base-200"
size="lg"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export default function Notes() {
} = useSprint();

useEffect(() => {
setData(sprints[sprintNumber - 1].teamMeetings[0].notes);
const sprint = sprints[sprintNumber - 1];
if (sprint.teamMeetingsData && sprint.teamMeetingsData.length) {
setData(sprint.teamMeetingsData[0].notes);
}
}, [sprints, sprintNumber]);

const {
Expand Down Expand Up @@ -101,6 +104,7 @@ export default function Notes() {
rows={2}
{...register("notes")}
errorMessage={errors.notes?.message}
defaultValue={data ?? ""}
/>
<Button
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,14 @@ export default function Planning() {
} = useSprint();

useEffect(() => {
setData(
sprints[sprintNumber - 1].teamMeetings[0].formResponseMeeting?.find(
(form) => form.form.id === Number(Forms.planning),
),
);
const sprint = sprints[sprintNumber - 1];
if (sprint.teamMeetingsData && sprint.teamMeetingsData.length) {
setData(
sprint.teamMeetingsData[0].formResponseMeeting?.find(
(form) => form.form.id === Number(Forms.planning),
),
);
}
}, [sprints, sprintNumber]);

const goal = data?.responseGroup.responses.find(
Expand Down
Loading

0 comments on commit 2f622a6

Please sign in to comment.