Skip to content

Commit

Permalink
food service friends
Browse files Browse the repository at this point in the history
  • Loading branch information
Shy committed Apr 17, 2024
1 parent 86b476c commit 9d16484
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 34 deletions.
80 changes: 60 additions & 20 deletions app/templates/attendee_rsvp.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
</p>
<p class="content is-size-4">
<i class="fa-regular fa-calendar"></i> {{event.date | humanize_ts}} |
<a id="calLink">Add to Cal</a> <br /><i class="fa-solid fa-location-dot" style="margin: 0 1.5px"></i>
<a id="calLink">Add to Cal</a> <br /><i
class="fa-solid fa-location-dot"
style="margin: 0 1.5px"
></i>
{{event.location}}
</p>
<p class="subtitle is-size-4">What am I inviting you to?</p>
Expand All @@ -30,30 +33,44 @@

<p class="subtitle is-size-4">What is this website?</p>
<p class="content">
<a href="https://youtu.be/gu0SjNfSzyQ">{{PARTY_NAME}}.Party is a worse version of partiful</a>. This page
specifically is your private event page for
<a href="https://youtu.be/gu0SjNfSzyQ"
>{{PARTY_NAME}}.Party is a worse version of partiful</a
>. This page specifically is your private event page for
{{event.event}}. Revisit this link to update your RSVP.
</p>
<p class="content">
If you want to opt out of future event invites, let me know and I'll
take you off the texting list.
</p>

<form id="submit_rsvp" action="/.netlify/functions/form-handler" method="post">
<input type="hidden" name="junction_pub" id="junction_pub" value="{{event_junction_public_id}}" />
<form
id="submit_rsvp"
action="/.netlify/functions/form-handler"
method="post"
>
<input
type="hidden"
name="junction_pub"
id="junction_pub"
value="{{event_junction_public_id}}"
/>

<div class="columns" id="rsvp-columns">
<div class="column has-text-centered">
<div id="attending-dropdown" class="dropdown is-up">
<div class="dropdown-trigger">
<button aria-haspopup="true" type="button" aria-controls="dropdown-menu" value="attending"
id="attending" data-text="Attending">
<button
aria-haspopup="true"
type="button"
aria-controls="dropdown-menu"
value="attending"
id="attending"
data-text="Attending"
>
😍 ATTENDEE_STATUS_HELP_UNKNOWN
</button>
</div>
<div class="dropdown-menu" role="menu">


<p class="title-dropdown">
Pick a chore to confirm your attendance
</p>
Expand All @@ -65,7 +82,8 @@

<hr class="dropdown-divider" />
<p data-el="🍽️" class="dropdown-item">
I'm attending, and I'm gonna move the furniture so folks can eat.
I'm attending, and I'm gonna move the furniture so folks can
eat.
</p>

<hr class="dropdown-divider" />
Expand All @@ -85,13 +103,18 @@
I'm attending, and I'm gonna take the garbage down into the
creepy basement.
</p>

<hr class="dropdown-divider" />
<p data-el="πŸͺ΅" class="dropdown-item">
I'm attending, and I'm gonna do assorted woodworking
projects around my apartment
</p>
<hr class="dropdown-divider" />
<p data-el="β˜•" class="dropdown-item">
Shy, I work in food services. If I helped I would be
breaking one of your silly dinner party rules so I'm just
gonna enjoy myself.
</p>
<hr class="dropdown-divider" />
<p data-el="πŸ§‘β€πŸΌ" class="dropdown-item" id="forParents">
Shy, I have a 10 month old baby at home. You're lucky to get
me to leave my apartment.
Expand All @@ -101,12 +124,24 @@
</div>
</div>
<div class="column has-text-centered">
<button type="submit" id="maybe" name="rsvp" value="maybe" data-text="Maybe">
<button
type="submit"
id="maybe"
name="rsvp"
value="maybe"
data-text="Maybe"
>
&#129300;
</button>
</div>
<div class="column has-text-centered">
<button type="submit" id="not_attending" name="rsvp" value="not_attending" data-text="Can't go.">
<button
type="submit"
id="not_attending"
name="rsvp"
value="not_attending"
data-text="Can't go."
>
&#128546;
</button>
</div>
Expand All @@ -117,7 +152,11 @@
</section>

{% endblock %} {% block js %}
<script src="https://cdn.jsdelivr.net/npm/add-to-calendar-button@1" async defer></script>
<script
src="https://cdn.jsdelivr.net/npm/add-to-calendar-button@1"
async
defer
></script>
<script>
document.getElementById("forParents").innerText =
"Shy, I have an " +
Expand Down Expand Up @@ -170,8 +209,8 @@

function removeSelfFromList() {
[...$attendeesList.children].find((el) => {
if (el.innerText.split(' ')[1] == "{{attendee.attendee.split()[0]}}"){
$attendeesList.removeChild(el)
if (el.innerText.split(" ")[1] == "{{attendee.attendee.split()[0]}}") {
$attendeesList.removeChild(el);
}
});
}
Expand All @@ -195,7 +234,7 @@
case "attending":
removeSelfFromList();
const li = document.createElement("li");
li.innerText = help +" {{attendee.attendee.split()[0]}}";
li.innerText = help + " {{attendee.attendee.split()[0]}}";
$attendeesList.appendChild(li);
helpMessage = {
"🧽": "washing the dishes after the main course at",
Expand All @@ -204,7 +243,8 @@
"πŸ—‘οΈ": "taking the trash down to the scary basement whenever it gets full at",
"πŸͺ΅": "doing home improvement projects in exchange for meals at",
"πŸ§‘β€πŸΌ": "attending and bringing a cute baby for people to hang out with",
"🍽️": "attending and moving furniture so people can eat at"
"🍽️": "attending and moving furniture so people can eat at",
"β˜•": "attending and just enjoying good food and good friends",
};
consoleText([attendeeStatus.innerText, helpMessage[help]]);
break;
Expand Down Expand Up @@ -283,7 +323,7 @@
var refreshIntervalId = window.setInterval(function () {
if (
words[0].substring(0, letterCount) ===
words[1].substring(0, letterCount) &&
words[1].substring(0, letterCount) &&
waiting === false
) {
waiting = true;
Expand Down Expand Up @@ -313,4 +353,4 @@
}, 100);
}
</script>
{% endblock %}
{% endblock %}
22 changes: 8 additions & 14 deletions netlify/edge-functions/attendee_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export default async (request, context) => {
"🧽": "attending and washing the dishes after the main course",
"🧹": "attending and staying to clean",
"🧀": "attending and washing the dishes after desert",
"πŸ—‘οΈ":
"attending and will take the trash down to the scary basement whenever it gets full",
"πŸ—‘οΈ": "attending and will take the trash down to the scary basement whenever it gets full",
"πŸͺ΅": "attending and doing assorted woodworking projects around my home",
"πŸ§‘β€πŸΌ":
"attending and I should feel thankful that I've managed to get you out of your apartment for the first time in months",
"🍳": "hosting",
"🍽️": "attending and moving furniture so people can eat at"
"πŸ§‘β€πŸΌ": "attending and I should feel thankful that I've managed to get you out of your apartment for the first time in months",
"🍳": "hosting",
"🍽️": "attending and moving furniture so people can eat at",
"β˜•": "attending and just enjoying good food and good friends",
};

const event_id_lookup = await supabase
Expand All @@ -39,13 +38,8 @@ export default async (request, context) => {

let attendingArray = [];
attending_lookup.data.forEach((attendee) => {
if (attendee.help){
console.log(attendee.help + " " + attendee.attendee.attendee + " is visiting.");
}else {
console.log(attendee.attendee.attendee + " is visiting.");
}
attendingArray.push(
attendee.help + " " + attendee.attendee.attendee.split(" ")[0],
attendee.help + " " + attendee.attendee.attendee.split(" ")[0]
);
}, attendingArray);

Expand All @@ -66,12 +60,12 @@ export default async (request, context) => {
.replace(/STATUS_UNKNOWN/i, statusKnown)
.replace(
/ATTENDEE_STATUS_UNKNOWN/i,
event_id_lookup.data[0]["rsvp"] || "",
event_id_lookup.data[0]["rsvp"] || ""
)
.replace(/ATTENDEES_UNKNOWN/i, attendingArray)
.replace(
/ATTENDEE_STATUS_HELP_UNKNOWN/i,
event_id_lookup.data[0]["help"] || "",
event_id_lookup.data[0]["help"] || ""
);

return new Response(updatedPage, response);
Expand Down

0 comments on commit 9d16484

Please sign in to comment.