💄 Work on Achievements dialog styling
This commit is contained in:
1 parent
b09bd43550
commit
2df81358d0
4 files changed
+36
-17
No files matched your search
@@ -48,6 +48,9 @@ class InstanceStats(BaseModel):
|
||||
prints_finished: int = 0
|
||||
"""Number of prints finished."""
|
||||
|
||||
prints_started_per_weekday: Dict[int, int] = {}
|
||||
"""Number of prints started per weekday."""
|
||||
|
||||
print_duration_total: float = 0
|
||||
"""Total print duration."""
|
||||
|
||||
@@ -219,11 +222,13 @@ class Achievements(metaclass=AchievementsMetaClass):
|
||||
EARLY_BIRD = Achievement(
|
||||
name="Early Bird",
|
||||
description="Start a print between 03:00 and 07:00.",
|
||||
hidden=True,
|
||||
)
|
||||
|
||||
NIGHT_OWL = Achievement(
|
||||
name="Night Owl",
|
||||
description="Start a print between 23:00 and 03:00.",
|
||||
hidden=True,
|
||||
)
|
||||
|
||||
TGIF = Achievement(
|
||||
@@ -257,6 +262,7 @@ class Achievements(metaclass=AchievementsMetaClass):
|
||||
SANTAS_LITTLE_HELPER = Achievement(
|
||||
name="Santa's Little Helper",
|
||||
description="Start a print between December 1st and December 24th.",
|
||||
hidden=True,
|
||||
)
|
||||
|
||||
SO_CLOSE = Achievement(
|
||||
@@ -287,6 +293,11 @@ class Achievements(metaclass=AchievementsMetaClass):
|
||||
nag=True,
|
||||
)
|
||||
|
||||
WEEKEND_WARRIOR = Achievement(
|
||||
name="Weekend Warrior",
|
||||
description="Print on four consecutive weekends.",
|
||||
)
|
||||
|
||||
|
||||
class AchievementsPlugin(
|
||||
octoprint.plugin.AssetPlugin,
|
||||
@@ -372,6 +383,10 @@ class AchievementsPlugin(
|
||||
if now.weekday() == 4:
|
||||
self._trigger_achievement(Achievements.TGIF, write=False)
|
||||
|
||||
self._data.stats.prints_started_per_weekday[now.weekday()] = (
|
||||
self._data.stats.prints_started_per_weekday.get(now.weekday(), 0) + 1
|
||||
)
|
||||
|
||||
changed = True
|
||||
|
||||
elif event == Events.PRINT_DONE:
|
||||
|
||||
@@ -1 +1 @@
|
||||
#plugin_achievements_list{columns:2;-webkit-columns:2;-moz-columns:2}.achievement-list{display:flex;width:100%;flex-wrap:wrap}.achievement-list .achievement-item{display:flex;flex:1 1 30%;padding:.5em;border:1px dotted #999;color:#999;margin:.5em;border-radius:.5em}.achievement-list .achievement-item.achieved{border-style:solid;color:#000}.achievement-list .achievement-item .achievement-logo{width:50px;height:50px;background-color:#aaa;margin-right:.5em}
|
||||
.achievement-list{display:flex;width:100%;flex-wrap:wrap}.achievement-list .achievement-item{display:flex;flex:1 1 30%;padding:.5em;margin:.5em;border:1px solid #666;border-radius:.5em;opacity:.5}.achievement-list .achievement-item.achieved{color:#fff;background-color:#08c;border:1px solid #069;opacity:1}.achievement-list .achievement-item .achievement-logo{width:50px;height:50px;min-width:50px;border:1px dotted #666;margin-right:.5em}
|
||||
@@ -123,7 +123,9 @@ $(function () {
|
||||
"<hr><p>" +
|
||||
_.sprintf(
|
||||
callsToAction[Math.floor(Math.random() * callsToAction.length)],
|
||||
{url: "https://support.octoprint.org"}
|
||||
{
|
||||
url: "https://octoprint.org/support-octoprint/?utm_source=octoprint&utm_medium=achievement_popup&utm_campaign=funding"
|
||||
}
|
||||
) +
|
||||
"</p>";
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#plugin_achievements_list {
|
||||
@achievementCols: 2;
|
||||
|
||||
columns: @achievementCols;
|
||||
-webkit-columns: @achievementCols;
|
||||
-moz-columns: @achievementCols;
|
||||
}
|
||||
|
||||
.achievement-list {
|
||||
@achievementColor: #fff;
|
||||
@achievementBackgroundColor: #08c;
|
||||
@achievementBorderColor: darken(@achievementBackgroundColor, 10%);
|
||||
|
||||
@achievementLogo: 50px;
|
||||
|
||||
display: flex;
|
||||
width: 100%;
|
||||
flex-wrap: wrap;
|
||||
@@ -15,20 +13,24 @@
|
||||
display: flex;
|
||||
flex: 1 1 30%;
|
||||
padding: 0.5em;
|
||||
border: 1px dotted #999;
|
||||
color: #999;
|
||||
margin: 0.5em;
|
||||
|
||||
border: 1px solid #666;
|
||||
border-radius: 0.5em;
|
||||
opacity: 0.5;
|
||||
|
||||
&.achieved {
|
||||
border-style: solid;
|
||||
color: #000;
|
||||
color: @achievementColor;
|
||||
background-color: @achievementBackgroundColor;
|
||||
border: 1px solid @achievementBorderColor;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.achievement-logo {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background-color: #aaa;
|
||||
width: @achievementLogo;
|
||||
height: @achievementLogo;
|
||||
min-width: @achievementLogo;
|
||||
border: 1px dotted #666;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user