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

fix: removed unused code #4178

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 => {
nickytonline marked this conversation as resolved.
Show resolved Hide resolved
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.

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
Loading