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

Valentine status overlay #4400

Merged
merged 5 commits into from
Feb 9, 2023
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/assets/stylesheets/base.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@

// 6. Seasonal css sheets
@import "seasonal/christmas.css.scss";
@import "seasonal/valentine.css.scss";

/* stylelint-disable-next-line selector-class-pattern */
.field_with_errors input {
Expand Down
26 changes: 26 additions & 0 deletions app/assets/stylesheets/seasonal/valentine.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.series-icon.valentine {
.overlay {
overflow: visible;
}

.overlay div {
content: "";
position: absolute;
width: 50px;
height: 50px;
margin-left: -5px;
background-size: contain;
background-repeat: no-repeat;
top: -5px;
}

&.completed:not(.deadline-missed) {
.icon-base {
visibility: hidden;
}

.overlay div {
content: url("seasonal/series_status_overlays/heart-rainbow.svg");
}
}
}
5 changes: 5 additions & 0 deletions app/helpers/seasonal_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ def christmas(current_time)
current_time.month == 12 && current_time.day > 6
end

def valentine(current_time)
current_time.month == 2 && current_time.day == 14
end

# returns seasonal class
def series_status_overlay
current_time = Time.now.in_time_zone(config.time_zone)

return 'christmas' if christmas(current_time)
return 'valentine' if valentine(current_time)

nil
end
Expand Down
23 changes: 13 additions & 10 deletions app/views/series/_series_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@
<stop stop-color="var(--purple)" offset="99%" />
</linearGradient>
</defs>
<circle cx="50%" cy="50%" r= "50%" fill="var(--icon-color)" class="outer-circle"></circle>
<circle cx="50%" cy="50%" r= "42%" fill="var(--icon-background-color)"></circle>
<foreignObject x="8" y="8" height="24" width="24" style="color: var(--icon-color)">
<i class="mdi <%= progress_icon %>"></i>
</foreignObject>

<% if deadline_icon %>
<circle cx="33" cy="34.5" r= "11" fill="var(--deadline-icon-background-color)"></circle>
<foreignObject x="24" y="26" height="18" width="18" style="color: var(--deadline-icon-color)">
<i class="mdi mdi-18 <%= deadline_icon %>"></i>
<g class="icon-base" >
<circle cx="50%" cy="50%" r= "50%" fill="var(--icon-color)" class="outer-circle"></circle>
<circle cx="50%" cy="50%" r= "42%" fill="var(--icon-background-color)"></circle>
<foreignObject x="8" y="8" height="24" width="24" style="color: var(--icon-color)">
<i class="mdi <%= progress_icon %>"></i>
</foreignObject>
<% end %>

<% if deadline_icon %>
<circle cx="33" cy="34.5" r= "11" fill="var(--deadline-icon-background-color)"></circle>
<foreignObject x="24" y="26" height="18" width="18" style="color: var(--deadline-icon-color)">
<i class="mdi mdi-18 <%= deadline_icon %>"></i>
</foreignObject>
<% end %>
</g>

<% if overlay_class %>
<foreignObject width="100%" height="100%" class="overlay">
Expand Down