Skip to content

Commit

Permalink
One hundred (#6394)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianjelfs authored Sep 16, 2024
1 parent f9279bf commit 077a980
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 4 deletions.
22 changes: 22 additions & 0 deletions frontend/app/public/assets/streaks/streak_100.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions frontend/app/public/assets/streaks/streak_365.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 33 additions & 4 deletions frontend/app/src/components/home/profile/Streak.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import TooltipWrapper from "../../TooltipWrapper.svelte";
import TooltipPopup from "../../TooltipPopup.svelte";
type Streak = "none" | "three" | "seven" | "fourteen" | "thirty";
type Streak =
| "none"
| "three"
| "seven"
| "fourteen"
| "thirty"
| "one hundred"
| "three six five";
export let days: number = 0;
export let showTooltip = true;
Expand All @@ -21,10 +28,14 @@
? "seven"
: days < 30
? "fourteen"
: "thirty";
: days < 100
? "thirty"
: days < 365
? "one hundred"
: "three six five";
}
function streakNumber(streak: Streak): 0 | 3 | 7 | 14 | 30 {
function streakNumber(streak: Streak): 0 | 3 | 7 | 14 | 30 | 100 | 365 {
switch (streak) {
case "none":
return 0;
Expand All @@ -36,14 +47,18 @@
return 14;
case "thirty":
return 30;
case "one hundred":
return 100;
case "three six five":
return 365;
}
}
</script>

{#if show}
{#if showTooltip}
<TooltipWrapper position="top" align="middle">
<div slot="target" class:disabled class={`icon ${streak}`}>
<div slot="target" class:disabled class={`icon ${streak.replace(/ /g, "_")}`}>
{num}
</div>
<div let:position let:align slot="tooltip">
Expand Down Expand Up @@ -95,6 +110,20 @@
background-image: url("/assets/streaks/streak_thirty.svg");
color: rgb(255, 0, 0);
}
&.one_hundred {
background-image: url("/assets/streaks/streak_100.svg");
color: white;
text-shadow: 0.5px 0.5px 0.5px #555;
}
&.three_six_five {
background-image: url("/assets/streaks/streak_365.svg");
color: white;
text-shadow: 0.5px 0.5px 0.5px #555;
padding: 0 0 0 7px;
}
&.disabled {
background-image: url("/assets/streaks/streak_disabled.svg");
color: #888;
Expand Down

0 comments on commit 077a980

Please sign in to comment.