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

feat/timeline-chart #7

Merged
merged 7 commits into from Mar 14, 2024
Merged

feat/timeline-chart #7

merged 7 commits into from Mar 14, 2024

Conversation

bonz88
Copy link
Owner

@bonz88 bonz88 commented Mar 10, 2024

Based on the selected timeline display chart for price and volume.

…oin. Added formating for XAxis on chart based on selected timeline. Added diferent colors for charts
Copy link

vercel bot commented Mar 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cryptofolio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 13, 2024 8:21pm

Comment on lines 114 to 136
const formatDateGraphs = (tick: string): string => {
const date = new Date(tick);
let formattedDate: string;

if (days === "1") {
formattedDate = date.toLocaleTimeString(undefined, {
hour: "2-digit",
minute: "2-digit",
hour12: false,
});
} else if (["7", "14", "30"].includes(days)) {
formattedDate = date.toLocaleDateString(undefined, {
day: "numeric",
month: "short",
});
} else if (["90", "180", "365", "max"].includes(days)) {
formattedDate = date.toLocaleDateString(undefined, {
day: "numeric",
month: "short",
year: "numeric",
});
} else {
formattedDate = date.toLocaleDateString();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be moved to a utility file from where you can export formatDateGraphs function because it does not depend on a state, it is a pure JS function.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one. It makes sense to move it to utility folder as separate function. It makes code so much cleaner. Doing it right now.

src/app/page.tsx Outdated
<div className="mt-10 max-w-[1440px] mx-auto xl:px-[72px] lg:px-[36px] md:px-[24px]">
<Timeline />
</div>
<div className="mt-10"></div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have this empty div?


setCurrentValue(`${lastValue.toFixed(2)}`);
setCurrentDate(lastDate);
}
}, [selectedCoins, chartType, currencyCode]);

if (loading === "pending") {
/* if (loading === "pending") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this commented out code?

Comment on lines 13 to 25
<button
className={`w-14 p-1 ${
t.active
? "bg-[rgb(120,120,250,0.7)] border border-[#7878FA] shadow-md rounded-md"
: ""
}`}
onClick={() => dispatch(activeTimeline(t.id))}
key={t.id}
>
<span className="dark:text-[#E4E4F0] text-[#181825] text-sm">
{t.display}
</span>
</button>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be moved into it's own separate component. What will you name this component?

@bonz88 bonz88 merged commit c90c45e into main Mar 14, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants