Skip to content

Commit

Permalink
Merge branch 'main' of github.com:chingu-x/chingu-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan-Y-Ko committed Jan 17, 2025
2 parents a355250 + a75f551 commit d4f0d91
Show file tree
Hide file tree
Showing 54 changed files with 689 additions and 526 deletions.
61 changes: 59 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,64 @@ 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.2] - 2024-08-28
## [0.1.1] - 2024-10-06

### Added
- Added tooltips over avatars https://github.com/chingu-x/chingu-dashboard/issues/221

### Fixed
- Fixed text truncation and spacing issues in features widget on dashboard page https://github.com/chingu-x/chingu-dashboard/issues/256

## [0.1.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

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

### Added


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

## [0.1.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


## [0.1.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

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

### Added
- Added version to image in avatar component
Expand All @@ -14,7 +71,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

### Fixed

## [1.0.0-alpha.1] - 2024-08-26
## [0.1.0-alpha.1] - 2024-08-26

### 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 @@ -50,18 +50,18 @@ function DashboardWidget({
>
<div className="inline-flex max-w-[100px] items-start text-neutral-focus">
<p
className={`relative inline-block text-[13px] font-semibold ${
className={`relative inline-block font-semibold ${
isWidgetClickable
? "cursor-pointer text-primary"
: "text-neutral-focus"
}`}
>
{headerTitle}
{isWidgetClickable ? (
<div className="absolute right-[-15px] top-[4px]">
<ChevronDoubleRightIcon className="ml-1 w-3" />
{isWidgetClickable && (
<div className="absolute right-0 top-1/2 translate-x-[110%] translate-y-[-45%]">
<ChevronDoubleRightIcon className="h-3 w-3" />
</div>
) : null}
)}
</p>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ interface FeaturesStateContentProps {
}
function FeaturesStateContent({ contentObject }: FeaturesStateContentProps) {
return (
<div className="mt-4 flex h-full flex-col justify-center">
<div className="flex max-h-[200px] w-full flex-col overflow-auto pr-3">
<div className="mt-4 flex h-full flex-col justify-start">
<div className="flex max-h-[200px] w-full flex-col gap-y-3 overflow-auto pr-3">
{contentObject?.map((item) => (
<div
key={item}
className="mb-3 flex h-[35px] items-center truncate rounded-lg bg-base-200 px-3 py-2"
className="flex items-center rounded-lg bg-base-200 px-3 py-2"
>
<p className="w-40 truncate max-[1469px]:w-[300px] max-[1200px]:w-full">
{item}
</p>
<p className="w-full break-words font-semibold">{item}</p>
</div>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useState } from "react";
import React from "react";
import { ArrowTopRightOnSquareIcon } from "@heroicons/react/24/solid";
import Badge from "@/components/badge/Badge";
import { useAppDispatch } from "@/store/hooks";
Expand All @@ -21,7 +21,6 @@ function ResourceItem({
userAvatarUrl,
}: ResourceItemProps) {
const dispatch = useAppDispatch();
const [widgetHovered, setWidgetHovered] = useState<boolean>(false);

const openViewModal = (event: React.MouseEvent) => {
event.stopPropagation();
Expand All @@ -40,17 +39,15 @@ function ResourceItem({
};

return (
<div
<button
type="button"
aria-label="open resource details"
key={title}
className="mb-4 flex h-[79px] w-full cursor-pointer items-center justify-between rounded-lg bg-base-200 p-4 hover:shadow-md"
className="group mb-4 flex w-full cursor-pointer items-center justify-between gap-x-4 rounded-lg bg-base-200 hover:shadow-md"
onClick={openViewModal}
onMouseEnter={() => setWidgetHovered(true)}
onMouseLeave={() => setWidgetHovered(false)}
>
<div className="flex max-w-[400px] flex-col">
<p className="mb-1 w-[300px] truncate text-base font-semibold max-[1469px]:w-full max-[1200px]:w-56">
{title}
</p>
<div className="flex flex-col p-4">
<p className="mb-1 text-left text-base font-semibold">{title}</p>
<div className="flex">
<p className="mr-2 text-base font-medium">Shared by</p>
<Badge
Expand All @@ -61,12 +58,8 @@ function ResourceItem({
/>
</div>
</div>
<ArrowTopRightOnSquareIcon
className={`mr-3 h-6 w-6 text-base-300 ${
widgetHovered ? "stroke-base-300" : ""
}`}
/>
</div>
<ArrowTopRightOnSquareIcon className="m-7 h-6 w-6 shrink-0 text-base-300 group-hover:stroke-base-300" />
</button>
);
}

Expand Down
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 @@ -42,11 +42,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
107 changes: 107 additions & 0 deletions src/app/(main)/my-voyage/[teamId]/features/components/Card.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { render } from "@testing-library/react";
import { configureStore } from "@reduxjs/toolkit";
import { Provider } from "react-redux";
import React from "react";
import Card from "./Card";
import { type Feature, features } from "./fixtures/Features";
import { rootReducer } from "@/store/store";
import { useUser } from "@/store/hooks";

jest.mock("./EditPopover", () => <div>mock child component</div>);
jest.mock("@/store/hooks", () => ({
useUser: jest.fn(),
}));
jest.mock("@hello-pangea/dnd", () => ({
DragDropContext: ({ children }: { children: React.ReactNode }) => (
<div>{children}</div>
),
Droppable: ({
children,
}: {
children: (provided: {
droppableProps: Record<string, unknown>;
innerRef: React.RefObject<HTMLDivElement>;
}) => React.ReactNode;
}) => (
<div>
{children({
droppableProps: {},
innerRef: React.createRef<HTMLDivElement>(),
})}
</div>
),
Draggable: ({
children,
}: {
children: (provided: {
draggableProps: Record<string, unknown>;
dragHandleProps: Record<string, unknown>;
innerRef: React.RefObject<HTMLDivElement>;
}) => React.ReactNode;
}) => (
<div>
{children({
draggableProps: {},
dragHandleProps: {},
innerRef: React.createRef<HTMLDivElement>(),
})}
</div>
),
}));

// "current user" id is 25b7b76c-1567-4910-9d50-e78819daccf1
const renderWithStore = (feature: Feature, userId: string) => {
const store = configureStore({
reducer: rootReducer,
});

(useUser as jest.Mock).mockReturnValue({ id: userId });

return render(
<Provider store={store}>
<Card index={1} feature={feature} setEditMode={jest.fn()} />
</Provider>,
);
};

describe("Feature Card component", () => {
beforeEach(() => {
jest.clearAllMocks();
});

it("renders edit button if current user's id matches id of user who added feature", () => {
const card = renderWithStore(
features[0],
"25b7b76c-1567-4910-9d50-e78819daccf1",
);

const cardAction = card.getByRole("button", { name: /feature menu/i });
const avatar = card.queryByRole("img", { name: /avatar/i });

expect(cardAction).toBeInTheDocument();
expect(avatar).not.toBeInTheDocument();
});

it("renders avatar if current user's id doesn't match id of user who added feature", () => {
const card = renderWithStore(
features[0],
"5d6eb1aa-6e9c-4b26-a363-6a35e5d76daa",
);

const cardAction = card.queryByRole("button", { name: /feature menu/i });
const avatar = card.getByRole("img", { name: /avatar/i });

expect(cardAction).not.toBeInTheDocument();
expect(avatar).toBeInTheDocument();
});

it("wraps long word to new line", () => {
const card = renderWithStore(
features[0],
"5d6eb1aa-6e9c-4b26-a363-6a35e5d76daa",
);

const description = card.getByText(features[0].description);
expect(description.closest("span")).toHaveClass("break-all");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export default function Card({ feature, index, setEditMode }: CardProps) {
)}
<div className="flex items-center justify-between">
<div className="flex flex-col gap-y-1">
<span className="text-base font-semibold">{description}</span>
<span className="break-all text-base font-semibold">
{description}
</span>
<span className="text-[10px] text-neutral-focus">{`Added by ${
isCurrentUser ? "you" : firstName + " " + lastName
}`}</span>
Expand Down
Loading

0 comments on commit d4f0d91

Please sign in to comment.