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

🐛 Minor design fixes #1039

Merged
merged 5 commits into from
Nov 20, 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
2 changes: 1 addition & 1 deletion packages/profile/src/components/achievements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function Achievements() {
{achievements.length ? (
<LayoutContent className="pb-4 select-none">
{isSelf && (
<div className="flex justify-between gap-4">
<div className="flex justify-between gap-x-3 gap-y-4">
<TrophiesTab
active={activeTab === "trophies"}
completed={completed}
Expand Down
9 changes: 2 additions & 7 deletions packages/profile/src/components/achievements/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ function Row({
self && "bg-quaternary text-primary",
)}
>
<div className="flex items-center justify-between grow sticky top-0">
<div className="flex items-center justify-between grow sticky top-0 gap-x-3">
<div className="flex items-center gap-x-4 sticky top-0">
<p className="text-muted-foreground min-w-6 sticky top-0">{`${rank}.`}</p>
<User
username={!username ? address.slice(0, 9) : username}
self={self}
Icon={SpaceInvaderIcon}
/>
</div>
Expand All @@ -107,19 +106,15 @@ function Row({

function User({
username,
self,
Icon,
}: {
username: string;
self: boolean;
Icon: React.ComponentType<StateIconProps>;
}) {
return (
<div className="flex items-center gap-x-2">
<Icon className="shrink-0" size="default" variant="line" />
<p className="text-ellipsis line-clamp-1 break-all">
{self ? `${username} (you)` : username}
</p>
<p className="text-ellipsis line-clamp-1 break-all">{username}</p>
</div>
);
}
Expand Down
13 changes: 8 additions & 5 deletions packages/profile/src/components/achievements/tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export function TrophiesTab({
onClick: () => void;
}) {
return (
<Tab active={active} onClick={onClick}>
<Tab priority={true} active={active} onClick={onClick}>
<Item Icon={TrophyIcon} active={active} label={"Achievements"} />
<p className="bg-quinary text-xs rounded-2xl px-2 py-1 font-bold">
<p className="bg-quinary text-xs rounded-2xl px-1.5 py-0.5 font-bold">
{`${completed}/${total}`}
</p>
</Tab>
Expand All @@ -40,7 +40,7 @@ export function LeaderboardTab({
onClick: () => void;
}) {
return (
<Tab active={active} onClick={onClick}>
<Tab priority={false} active={active} onClick={onClick}>
<Item
Icon={LeaderboardIcon}
active={active}
Expand Down Expand Up @@ -76,10 +76,12 @@ export function Scoreboard({

export function Tab({
active,
priority,
onClick,
children,
}: {
active: boolean;
priority: boolean;
onClick: () => void;
children: React.ReactNode;
}) {
Expand All @@ -88,7 +90,8 @@ export function Tab({
return (
<div
className={cn(
"h-10 flex justify-between items-center grow border border-secondary rounded-md px-4 py-2 cursor-pointer",
"h-10 grow w-1/2 flex justify-between items-center gap-2 border border-secondary rounded-md p-3 cursor-pointer",
priority && "min-w-1/2",
active ? "opacity-100 bg-secondary" : "opacity-50 bg-background",
hovered && (active ? "opacity-90" : "bg-secondary/50"),
)}
Expand All @@ -111,7 +114,7 @@ export function Item({
label: string;
}) {
return (
<div className="flex items-center gap-2">
<div className="flex items-center gap-1">
<Icon size="sm" variant={active ? "solid" : "line"} />
<p className="text-sm">{label}</p>
</div>
Expand Down
48 changes: 25 additions & 23 deletions packages/profile/src/components/achievements/trophies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function Trophies({
);

return (
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-4">
<div className="h-8 bg-secondary py-2 px-3 flex items-center justify-between gap-4 rounded-md overflow-hidden">
<p className="uppercase text-xs text-quaternary-foreground font-semibold tracking-wider">
Total
Expand All @@ -64,28 +64,30 @@ export function Trophies({
{`${completed} of ${total}`}
</p>
</div>
{Object.entries(groups)
.filter(([group]) => group !== HIDDEN_GROUP)
.map(([group, items]) => (
<Group
key={group}
group={group}
items={items}
softview={softview}
enabled={enabled}
onPin={onPin}
/>
))}
<Group
key={HIDDEN_GROUP}
group={HIDDEN_GROUP}
items={(groups[HIDDEN_GROUP] || []).sort(
(a, b) => a.earning - b.earning,
)}
softview={softview}
enabled={enabled}
onPin={onPin}
/>
<div className="flex flex-col gap-3">
{Object.entries(groups)
.filter(([group]) => group !== HIDDEN_GROUP)
.map(([group, items]) => (
<Group
key={group}
group={group}
items={items}
softview={softview}
enabled={enabled}
onPin={onPin}
/>
))}
<Group
key={HIDDEN_GROUP}
group={HIDDEN_GROUP}
items={(groups[HIDDEN_GROUP] || []).sort(
(a, b) => a.earning - b.earning,
)}
softview={softview}
enabled={enabled}
onPin={onPin}
/>
</div>
</div>
);
}
Expand Down
20 changes: 4 additions & 16 deletions packages/profile/src/components/achievements/trophy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,28 +261,16 @@ function Progress({
)}
/>
</div>
{count >= total && total > 1 ? (
<div className="flex items-center gap-1">
{count >= total ? (
<div className="flex items-center gap-x-2">
<div className="fa-solid fa-check text-xs text-quaternary-foreground" />
<p className="text-xs text-quaternary-foreground font-medium">
{`${count.toLocaleString()}`}
{total > 1 ? `${count.toLocaleString()}` : "Completed"}
</p>
</div>
) : total > 1 ? (
<div className="flex items-center gap-1">
<div className="text-xs text-quaternary-foreground" />
<p className="text-xs text-quaternary-foreground font-medium">
{`${count.toLocaleString()} of ${total.toLocaleString()}`}
</p>
</div>
) : count >= total ? (
<div className="flex items-center gap-1">
<div className="fa-solid fa-check text-xs text-quaternary-foreground" />
<p className="text-xs text-quaternary-foreground">Completed</p>
</div>
) : (
<p className="text-xs text-quaternary-foreground font-medium">
{`${count.toLocaleString()} / ${total.toLocaleString()}`}
{`${count.toLocaleString()} of ${total.toLocaleString()}`}
</p>
)}
</div>
Expand Down
Loading