Skip to content

Commit

Permalink
fix: removed unused code (#4178)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickytonline authored Oct 21, 2024
1 parent f3fea9e commit d6fff39
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 148 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { useEffect, useState } from "react";
import Text from "components/atoms/Typography/text";
import Tooltip from "components/atoms/Tooltip/tooltip";
import colors from "../../../lib/utils/color.json";

export interface AllSimpleColors {
Expand All @@ -19,22 +17,15 @@ export interface LanguageObject {

interface CardHorizontalBarChartProps {
languageList: LanguageObject[];
withDescription: boolean;
}

const languageToColor: AllSimpleColors = colors as AllSimpleColors;

const CardHorizontalBarChart = ({ languageList, withDescription }: CardHorizontalBarChartProps): JSX.Element => {
const CardHorizontalBarChart = ({ languageList }: CardHorizontalBarChartProps): JSX.Element => {
const sortedLangArray = languageList.sort((a, b) => b.percentageUsed - a.percentageUsed);
// used this state to calculate thte percentage of each language
const [percentage, setPercentage] = useState<any>(0);

const [descriptText, setDescriptText] = useState(sortedLangArray[0]?.languageName || "javascript");

const handleChangeDescriptText = (descriptText: string) => {
setDescriptText(descriptText);
};

useEffect(() => {
if (sortedLangArray.length === 0) return;

Expand All @@ -54,7 +45,6 @@ const CardHorizontalBarChart = ({ languageList, withDescription }: CardHorizonta
index < 5 && (
<div
key={index}
onMouseOver={() => handleChangeDescriptText(languageName)}
className="h-2 transition-all duration-500 ease-in-out"
style={{
width: `${percentageUsed < 20 ? (percentageUsed / percentage) * 100 : percentageUsed}%`,
Expand All @@ -67,21 +57,6 @@ const CardHorizontalBarChart = ({ languageList, withDescription }: CardHorizonta
);
})}
</div>
{withDescription && (
<div className="flex gap-2 w-32 items-baseline">
<div
className={"w-2 h-2 rounded-full"}
style={{
backgroundColor: languageToColor[descriptText]
? (languageToColor[descriptText].color as string)
: NOTSUPPORTED,
}}
/>
<Tooltip className="max-w-[100px]" content={descriptText}>
<Text className="!text-xs !truncate !font-semibold !text-light-slate-11">{descriptText}</Text>
</Tooltip>
</div>
)}
</div>
);
};
Expand Down

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion components/organisms/ContributorCard/contributor-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const ContributorCard = ({
</div>
</div>
<div className="flex flex-col items-end gap-2">
<CardHorizontalBarChart withDescription={false} languageList={languageList} />
<CardHorizontalBarChart languageList={languageList} />
{!!isMaintainer && <Badge text="maintainer" />}
</div>
</div>
Expand Down

0 comments on commit d6fff39

Please sign in to comment.