Skip to content
Closed
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
Binary file added app/assets/images/sidequests/party.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/components/_sidequest_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
--color-content-darker: #9a3a3d;
}

&--party-purple {
--color-card-bg: #fae8ff;
--color-content-bg: #ca76ee;
--color-content-darker: #D6A6EA;
}

&--roasted-apples {
--color-card-bg: #f5d8ba;
--color-content-bg: #9e3f2d;
Expand Down
13 changes: 13 additions & 0 deletions app/models/achievement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ def initialize(slug:, name:, description:, icon:, earned_check:, progress: nil,
.exists?
}
),
new(
slug: :sidequest_party,
name: "Sidequest: Party",
description: "Shipped a project for the Party sidequest!",
icon: "trophy",
earned_check: ->(user) {
SidequestEntry.approved
.joins(:sidequest, project: :memberships)
.where(sidequests: { slug: "party" })
.where(project_memberships: { user_id: user.id, role: "owner" })
.exists?
}
),
new(
slug: :sidequest_converge,
name: "Sidequest: Converge",
Expand Down
32 changes: 32 additions & 0 deletions app/models/sidequest/callbacks/party.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

module Sidequest::Callbacks
class Party
class << self
def on_approve(entry)
user = entry.project_owner
return unless user

user.award_achievement!(:sidequest_party)

SendSlackDmJob.perform_later(
user.id,
nil,
blocks_path: "notifications/sidequests/party_approved",
locals: { entry: entry, user: user }
)
end

def on_reject(entry)
user = entry.project_owner
return unless user

SendSlackDmJob.perform_later(
user.id,
nil,
blocks_path: "notifications/sidequests/party_rejected",
locals: { entry: entry, user: user }
)
end
end
end
end

Check failure on line 32 in app/models/sidequest/callbacks/party.rb

View workflow job for this annotation

GitHub Actions / RuboCop

Layout/TrailingEmptyLines: Final newline missing.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
header "🎉Party Sidequest Complete!"

section "Your project *#{entry.project.title}* has been approved for the Party sidequest!", markdown: true

section "You've unlocked the *Sidequest: Party* achievement!! You can also get some cool multiplayer goodies!", markdown: true

divider

content [
mrkdwn_text("*Imagine theres a lot of confetti right here*" )
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
header "❌ Party Sidequest Submission Not Approved"

section "Your project *#{entry.project.title}* wasn't approved for the Party sidequest.", markdown: true

if entry.rejection_message.present?
section "*Reason:* #{entry.rejection_message}", markdown: true
else
section "This could be because the project doesn't meet the requirements. Feel free to update your project and try again!", markdown: true
end

divider

context [
mrkdwn_text("Questions? Reach out to Kaplin86 on Slack.")
]
15 changes: 15 additions & 0 deletions app/views/sidequests/_party.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%= link_to sidequest_path(sidequest), id: "party", class: "sidequest-card sidequest-card--party-purple sidequest-card--link" do %>
<div class="sidequest-card__content">
<h1 class="sidequest-card__title">Party</h1>
<div class="sidequest-card__image-container">
<%= image_tag "sidequests/party.png",
alt: "",
aria: {hidden: true},
class: "sidequest-card__image" %>
</div>
<h2>Build a multiplayer game. Submit to this sidequest to unlock a new shop item (and discounts on some other ones too)!</h2>
<% if sidequest.approved_count > 0 %>
<p class="sidequest-card__expires"><%= pluralize(sidequest.approved_count, "submission") %></p>
<% end %>
</div>
<% end %>
80 changes: 80 additions & 0 deletions app/views/sidequests/show_party.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<% content_for :title, @sidequest.title %>
<% content_for :og_description, truncate(@sidequest.description.to_s, length: 200) %>
<% content_for :og_image, og_image_url('sidequests', format: :png) %>
<% content_for :twitter_card, "summary_large_image" %>

<%= render HeadingComponent.new(title: @sidequest.title, tone: :blue, size: :full) %>

<div class="sidequest-show sidequest-show--optimization">
<div class="sidequest-show__content">
<% if @sidequest.description.present? %>
<p class="sidequest-show__description"><%= @sidequest.description %></p>
<% end %>

<div class="sidequest-show__info-grid">
<section class="sidequest-show__info-card">
<h3 class="sidequest-show__info-title">Requirements</h3>
<ul class="sidequest-show__steps">
<li>Your game must have an element of online multiplayer.</li>
<li>Any particular multiplayer system will work as long as you can play the game with friends!</li>
<li>Add a short README section that explains any prerequisites needed to run multiplayer for your game (if any)</li>
<li>Ship it on Flavortown and submit it to this sidequest when shipping!.</li>
</ul>
</section>

<section class="sidequest-show__info-card">
<h3 class="sidequest-show__info-title">What if I don't want to make a server system?</h3>
<p> Well your in luck! I (kaplin86) am running my own party-based multiplayer system for the remaining time of flavortown.
You can read more <a href="https://github.com/Kaplin86/party-api">Here</a> and even
see an <a href="https://github.com/Kaplin86/party-example-project/tree/main">Example Project</a> too!</p>
</section>
</div>

<% if @prizes.present? && @prizes.any? %>
<section class="sidequest-show__info-card sidequest-show__prizes-card">
<h3 class="sidequest-show__info-title">Prizes</h3>
<div class="sidequest-show__prizes-list">
<% @prizes.each do |prize| %>
<%= link_to "/shop/order?shop_item_id=#{prize.id}", class: "sidequest-show__prize-row" do %>
<% if prize.image.attached? %>
<div class="sidequest-show__prize-image">
<%= image_tag prize.image.variant(:carousel_sm), alt: prize.name, loading: "lazy" %>
</div>
<% end %>
<span class="sidequest-show__prize-name"><%= prize.name %></span>
<span class="sidequest-show__prize-cost"><%= number_to_currency(prize.ticket_cost, precision: 0).gsub('$', '') %></span>
<% end %>
<% end %>
</div>
</section>
<% end %>

<% if @approved_entries.any? %>
<div class="sidequest-show__gallery">
<h3 class="sidequest-show__gallery-title"><%= @approved_entries.size %> <%= "submission".pluralize(@approved_entries.size) %></h3>
<div class="sidequest-show__gallery-grid">
<% @approved_entries.each do |entry| %>
<% project = entry.project %>
<% next unless project.present? %>
<div class="sidequest-show__gallery-item">
<%= render partial: "projects/card", locals: { project: project } %>
</div>
<% end %>
</div>
</div>
<% else %>
<div class="sidequest-show__stats">
<p><strong>Be the first to submit</strong></p>
</div>
<% end %>

<div class="sidequest-show__actions">
<%= render ButtonComponent.new(
text: "Back to Sidequests",
href: sidequests_path,
color: :brown,
variant: :borderless
) %>
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
sq.title = "Physics Lab"
sq.description = "Build an interactive physics project and ship it on Flavortown to unlock physics prizes in the shop."
end

Sidequest.find_or_create_by!(slug: "party") do |sq|
sq.title = "Party"
sq.description = "Build a multiplayer game, then unlock prizes that help you play with friends."
end

Sidequest.find_or_create_by!(slug: "codextensions") do |sq|
sq.title = "Codextensions"
sq.description = "Build a VS Code extension and ship it on Flavortown to unlock exclusive prizes in the shop."
Expand Down
Loading