diff --git a/app/assets/images/sidequests/party.png b/app/assets/images/sidequests/party.png new file mode 100644 index 000000000..a7d403a1a Binary files /dev/null and b/app/assets/images/sidequests/party.png differ diff --git a/app/assets/stylesheets/components/_sidequest_card.scss b/app/assets/stylesheets/components/_sidequest_card.scss index d05bef622..8b1a08bb5 100644 --- a/app/assets/stylesheets/components/_sidequest_card.scss +++ b/app/assets/stylesheets/components/_sidequest_card.scss @@ -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; diff --git a/app/models/achievement.rb b/app/models/achievement.rb index c62671b10..b44a6edf5 100644 --- a/app/models/achievement.rb +++ b/app/models/achievement.rb @@ -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", diff --git a/app/models/sidequest/callbacks/party.rb b/app/models/sidequest/callbacks/party.rb new file mode 100644 index 000000000..c95328f05 --- /dev/null +++ b/app/models/sidequest/callbacks/party.rb @@ -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 \ No newline at end of file diff --git a/app/views/notifications/sidequests/party_approved.slack_message.slocks b/app/views/notifications/sidequests/party_approved.slack_message.slocks new file mode 100644 index 000000000..a267e52a8 --- /dev/null +++ b/app/views/notifications/sidequests/party_approved.slack_message.slocks @@ -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*" ) +] diff --git a/app/views/notifications/sidequests/party_rejected.slack_message.slocks b/app/views/notifications/sidequests/party_rejected.slack_message.slocks new file mode 100644 index 000000000..23ac96e4b --- /dev/null +++ b/app/views/notifications/sidequests/party_rejected.slack_message.slocks @@ -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.") +] diff --git a/app/views/sidequests/_party.html.erb b/app/views/sidequests/_party.html.erb new file mode 100644 index 000000000..ed6ad5e78 --- /dev/null +++ b/app/views/sidequests/_party.html.erb @@ -0,0 +1,15 @@ +<%= link_to sidequest_path(sidequest), id: "party", class: "sidequest-card sidequest-card--party-purple sidequest-card--link" do %> +
+

Party

+
+ <%= image_tag "sidequests/party.png", + alt: "", + aria: {hidden: true}, + class: "sidequest-card__image" %> +
+

Build a multiplayer game. Submit to this sidequest to unlock a new shop item (and discounts on some other ones too)!

+ <% if sidequest.approved_count > 0 %> +

<%= pluralize(sidequest.approved_count, "submission") %>

+ <% end %> +
+<% end %> diff --git a/app/views/sidequests/show_party.html.erb b/app/views/sidequests/show_party.html.erb new file mode 100644 index 000000000..53bf60768 --- /dev/null +++ b/app/views/sidequests/show_party.html.erb @@ -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) %> + +
+
+ <% if @sidequest.description.present? %> +

<%= @sidequest.description %>

+ <% end %> + +
+
+

Requirements

+
    +
  • Your game must have an element of online multiplayer.
  • +
  • Any particular multiplayer system will work as long as you can play the game with friends!
  • +
  • Add a short README section that explains any prerequisites needed to run multiplayer for your game (if any)
  • +
  • Ship it on Flavortown and submit it to this sidequest when shipping!.
  • +
+
+ +
+

What if I don't want to make a server system?

+

Well your in luck! I (kaplin86) am running my own party-based multiplayer system for the remaining time of flavortown. + You can read more Here and even + see an Example Project too!

+
+
+ +<% if @prizes.present? && @prizes.any? %> +
+

Prizes

+
+ <% @prizes.each do |prize| %> + <%= link_to "/shop/order?shop_item_id=#{prize.id}", class: "sidequest-show__prize-row" do %> + <% if prize.image.attached? %> +
+ <%= image_tag prize.image.variant(:carousel_sm), alt: prize.name, loading: "lazy" %> +
+ <% end %> + <%= prize.name %> + <%= number_to_currency(prize.ticket_cost, precision: 0).gsub('$', '') %> + <% end %> + <% end %> +
+
+ <% end %> + + <% if @approved_entries.any? %> + + <% else %> +
+

Be the first to submit

+
+ <% end %> + +
+ <%= render ButtonComponent.new( + text: "Back to Sidequests", + href: sidequests_path, + color: :brown, + variant: :borderless + ) %> +
+
+
diff --git a/db/seeds.rb b/db/seeds.rb index c8b7704c4..d28bdaba5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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."