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

v0.1.1 #273

Merged
merged 22 commits into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
920cd9c
add background color to handle transparent avatars
Dan-Y-Ko Aug 29, 2024
f67d6f5
add test
Dan-Y-Ko Aug 29, 2024
891ad1e
fix: fix padding issues + update widget title font size
JaneMoroz Sep 18, 2024
9d040b9
fix: lint
JaneMoroz Sep 18, 2024
b3e3c1f
Merge branch 'dev' into fix/avatar-tooltip
JaneMoroz Sep 18, 2024
dd6d1bf
feat: add tooltip to avatar groups in techStack and Ideation votes
JaneMoroz Sep 18, 2024
9a69200
Merge branch 'dev' into fix/feature-widget-padding-issue
Dan-Y-Ko Sep 20, 2024
a1168e5
Merge branch 'dev' into fix/avatar-tooltip
Dan-Y-Ko Sep 20, 2024
8bb7562
fix: update colors
JaneMoroz Sep 20, 2024
f5f967f
fix: prettier
JaneMoroz Sep 20, 2024
914cc22
fix: fix width
JaneMoroz Sep 20, 2024
4655623
fix: lint
JaneMoroz Sep 20, 2024
b48e4c5
Merge branch 'dev' into fix/feature-widget-padding-issue
JaneMoroz Sep 27, 2024
19c0c9d
Merge branch 'dev' into fix/avatar-tooltip
Dan-Y-Ko Sep 27, 2024
9218055
Merge branch 'dev' into fix/feature-widget-padding-issue
Dan-Y-Ko Sep 27, 2024
12b8a29
Merge branch 'dev' into fix/feature-widget-padding-issue
Dan-Y-Ko Oct 4, 2024
0506172
Merge branch 'dev' into fix/avatar-tooltip
Dan-Y-Ko Oct 4, 2024
7766209
Merge pull request #260 from chingu-x/fix/feature-widget-padding-issue
Dan-Y-Ko Oct 6, 2024
70ce78a
Merge branch 'dev' into fix/avatar-tooltip
Dan-Y-Ko Oct 6, 2024
a24e0e6
Merge pull request #262 from chingu-x/fix/avatar-tooltip
Dan-Y-Ko Oct 6, 2024
4b89a51
Update CHANGELOG.md
Dan-Y-Ko Oct 6, 2024
1476b24
Merge branch 'main' into dev
Dan-Y-Ko Oct 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ 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/).

## [0.1.1] - 2024-10-06

## [1.0.0-alpha.6] - 2024-09-27
### 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
Expand All @@ -18,15 +25,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

### Fixed

## [1.0.0-alpha.5] - 2024-09-19
## [0.1.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
## [0.1.0-alpha.4] - 2024-09-10

### Added

Expand All @@ -40,7 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- 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
## [0.1.0-alpha.3] - 2024-09-05

### Added
- Added 404 page https://github.com/chingu-x/chingu-dashboard/issues/205
Expand All @@ -55,7 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- 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
## [0.1.0-alpha.2] - 2024-08-28

### Added
- Added version to image in avatar component
Expand All @@ -64,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
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
Expand Up @@ -17,6 +17,7 @@ import {
import { onOpenModal } from "@/store/features/modal/modalSlice";
import AvatarGroup from "@/components/avatar/AvatarGroup";
import Avatar from "@/components/avatar/Avatar";
import Tooltip from "@/components/Tooltip";

interface VoteCardProps {
projectIdeaId: number;
Expand All @@ -33,6 +34,7 @@ function VoteCard({ projectIdeaId, users, className }: VoteCardProps) {
const { isOpen } = useModal();
const dispatch = useAppDispatch();
const [voteChanged, setVoteChanged] = useState<boolean>(false);
const [tooltipHovered, setTooltipHovered] = useState<string>("");

const {
runAction: addIdeationVoteAction,
Expand Down Expand Up @@ -131,12 +133,28 @@ function VoteCard({ projectIdeaId, users, className }: VoteCardProps) {
}`}</h2>
<AvatarGroup>
{users.map((user) => (
<Avatar
width={24}
height={24}
key={user.id}
image={user.votedBy.member.avatar}
/>
<Tooltip
key={user.votedBy.member.id}
content={`${user.votedBy.member.firstName}`}
customClassName="text-xs font-medium w-fit"
position="bottom"
tooltipWidth="small"
isDisplay={tooltipHovered === user.votedBy.member.id}
hovered={tooltipHovered === user.votedBy.member.id}
>
<Avatar
customClassName="border border-base-content"
width={24}
height={24}
image={user.votedBy.member.avatar}
onMouseEnter={() => {
setTooltipHovered(user.votedBy.member.id);
}}
onMouseLeave={() => {
setTooltipHovered("");
}}
/>
</Tooltip>
))}
</AvatarGroup>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { onOpenModal } from "@/store/features/modal/modalSlice";
import Spinner from "@/components/Spinner";
import { getCurrentVoyageTeam } from "@/utils/getCurrentVoyageTeam";
import { validateTextInput } from "@/utils/form/validateInput";
import Tooltip from "@/components/Tooltip";

interface TechStackCardProps {
title: string;
Expand Down Expand Up @@ -52,6 +53,8 @@ export default function TechStackCard({ title, data }: TechStackCardProps) {
const [isInput, setIsInput] = useState(false);
const [editItemId, setEditItemId] = useState(-1);
const [isDuplicate, setIsDuplicate] = useState(false);
const [tooltipHovered, setTooltipHovered] = useState<string>("");

const inputRef = useRef<HTMLFormElement>(null);
const editRef = useRef<HTMLFormElement>(null);
const items = data.map((item) => item.name.toLowerCase());
Expand Down Expand Up @@ -269,12 +272,35 @@ export default function TechStackCard({ title, data }: TechStackCardProps) {
<div className="col-span-2 ml-8 bg-base-200">
<AvatarGroup>
{element.teamTechStackItemVotes.map((vote) => (
<Avatar
<Tooltip
key={vote.votedBy.member.id}
image={vote.votedBy.member.avatar}
width={24}
height={24}
/>
content={`${vote.votedBy.member.firstName}`}
customClassName="text-xs font-medium w-fit"
position="bottom"
tooltipWidth="small"
isDisplay={
tooltipHovered ===
element.id + vote.votedBy.member.id
}
hovered={
tooltipHovered ===
element.id + vote.votedBy.member.id
}
>
<Avatar
image={vote.votedBy.member.avatar}
width={24}
height={24}
onMouseEnter={() => {
setTooltipHovered(
element.id + vote.votedBy.member.id,
);
}}
onMouseLeave={() => {
setTooltipHovered("");
}}
/>
</Tooltip>
))}
</AvatarGroup>
</div>
Expand Down
14 changes: 11 additions & 3 deletions src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface TooltipProps {
tooltipWidth: TooltipWidth;
isDisplay: boolean;
hovered: boolean;
customClassName?: string;
}

export default function Tooltip({
Expand All @@ -24,6 +25,7 @@ export default function Tooltip({
tooltipWidth,
isDisplay,
hovered,
customClassName,
}: TooltipProps) {
let nonSupportTextWidth;

Expand All @@ -40,11 +42,11 @@ export default function Tooltip({
{children}
<div
className={cn(
"absolute z-[2] break-all shadow-md transition duration-300 ease-in-out",
"absolute z-[2] break-all shadow-lg transition duration-300 ease-in-out",
supportText ? "text-left" : "text-center",
(!hovered || !isDisplay) && "hidden",
supportText ? "w-[320px]" : nonSupportTextWidth,
"rounded-lg bg-base-100 px-3 py-2 text-base-300 after:absolute after:border-8 after:border-solid after:border-base-100 after:content-['']",
"rounded-lg bg-base-200 px-3 py-2 text-base-300 after:absolute after:border-8 after:border-solid after:border-base-200 after:content-['']",
position === "top" || position === "bottom"
? "-translate-x-1/2 after:left-1/2 after:-translate-x-1/2 after:border-x-transparent"
: "-translate-y-1/2 after:top-1/2 after:-translate-y-1/2 after:border-y-transparent",
Expand All @@ -56,9 +58,15 @@ export default function Tooltip({
"left-full top-1/2 translate-x-3 after:right-full after:border-l-transparent",
position === "left" &&
"right-full top-1/2 -translate-x-3 after:left-full after:border-r-transparent",
customClassName,
)}
>
<div className={`${supportText && "mb-2"}`}>{content}</div>
<div
className={`${supportText && "mb-2"}`}
style={{ textWrap: "nowrap" }}
>
{content}
</div>
{supportText && <div>{supportText}</div>}
</div>
</div>
Expand Down
23 changes: 17 additions & 6 deletions src/components/avatar/Avatar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { render, screen } from "@testing-library/react";
import Avatar from "@/components/avatar/Avatar";

const imageUrl =
"https://gravatar.com/avatar/c8cf6521c193fc743c7fadcd8be04e983724764efa65b3c3913b6d22f086a11f?s=200&r=g&d=robohash";

describe("Avatar Component", () => {
it("renders image correctly", () => {
const imageUrl =
"https://gravatar.com/avatar/c8cf6521c193fc743c7fadcd8be04e983724764efa65b3c3913b6d22f086a11f?s=200&r=g&d=robohash";

render(<Avatar width={24} height={24} image={imageUrl} />);

const image = screen.getByRole("img", { name: /avatar/i });
Expand All @@ -14,9 +14,6 @@ describe("Avatar Component", () => {
});

it("should have correct image url", () => {
const imageUrl =
"https://gravatar.com/avatar/c8cf6521c193fc743c7fadcd8be04e983724764efa65b3c3913b6d22f086a11f?s=200&r=g&d=robohash";

render(<Avatar width={24} height={24} image={imageUrl} />);

const image: HTMLImageElement = screen.getByRole("img", {
Expand All @@ -25,4 +22,18 @@ describe("Avatar Component", () => {

expect(image.src).toContain(encodeURIComponent(`${imageUrl}&v=1.2`));
});

it("handles transparent avatars", () => {
render(<Avatar width={24} height={24} image={imageUrl} />);

const image: HTMLImageElement = screen.getByRole("img", {
name: /avatar/i,
});

const hasBgClass = Array.from(image.classList).some((className) =>
/^bg-.+/.test(className),
);

expect(hasBgClass).toBe(true);
});
});
9 changes: 8 additions & 1 deletion src/components/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@ interface AvatarProps {
customClassName?: string;
width: number;
height: number;
onMouseEnter?: () => void;
onMouseLeave?: () => void;
}

export default function Avatar({
image,
customClassName,
width = 24,
height = 24,
onMouseEnter,
onMouseLeave,
}: AvatarProps) {
return (
<div
className={cn(
"shrink-1 cursor-pointer overflow-hidden rounded-full border border-neutral px-0",
"shrink-1 cursor-pointer overflow-hidden rounded-full px-0",
customClassName,
)}
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
>
<Image
alt="avatar"
Expand All @@ -31,6 +37,7 @@ export default function Avatar({
}
width={width}
height={height}
className={cn("bg-base-200")}
/>
</div>
);
Expand Down
Loading