You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

401 lines
9.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <main>
  3. <!-- <nav>
  4. <button class="btn btn--header" @click="openPopup">
  5. <span></span>
  6. {{ mappedGuests.Language == "en" ? "click here" : "klik hier" }}
  7. <span></span>
  8. </button>
  9. </nav> -->
  10. <!-- <pre>
  11. {{ guests }}
  12. </pre> -->
  13. <!-- <ul class="test-links">
  14. <li v-for="guest in allGuests" :key="guest.code">
  15. <nuxt-link :to="'/' + guest.code">{{
  16. guest.names.join(" & ")
  17. }}</nuxt-link>
  18. </li>
  19. </ul> -->
  20. <!-- <div class="names">{{ guests.Names }}</div> -->
  21. <!-- <img
  22. class="img--bkg"
  23. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.gif`)"
  24. alt="wrongo-and-peanut"
  25. /> -->
  26. <video
  27. class="img--bkg"
  28. playsinline
  29. autoplay
  30. loop
  31. muted
  32. id="bgvid"
  33. :poster="require(`@/assets/images/bkgs/poster.png`)"
  34. >
  35. <!-- :poster="require(`@/assets/images/bkgs/poster.png`)" -->
  36. <!-- <source src="polina.webm" type="video/webm"> -->
  37. <source
  38. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.mp4`)"
  39. type="video/mp4"
  40. />
  41. </video>
  42. <!-- <video
  43. class="img--bkg"
  44. playsinline
  45. autoplay
  46. loop
  47. poster="https://assets.codepen.io/6093409/river.mp4"
  48. id="bgvid"
  49. >-->
  50. <!-- <source
  51. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.webm`)"
  52. type="video/webm"
  53. />
  54. <source
  55. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.mp4`)"
  56. type="video/mp4"
  57. />
  58. </video>-->
  59. <div v-if="isPopupVisible" class="popup-wrapper">
  60. <div class="popup">
  61. <button class="x" @click="openPopup">x</button>
  62. <h1>this is the header</h1>
  63. <p>this is the paragraph</p>
  64. <!-- <pre>
  65. {{ mappedGuests.Names.length }}
  66. </pre> -->
  67. <div class="buttons">
  68. <button @click="sayYes" class="btn btn--popup">
  69. <span>🞄</span>
  70. {{ yesText(mappedGuests.Language, mappedGuests.Names.length) }}
  71. <span>🞄</span>
  72. </button>
  73. <button @click="sayNo" class="btn btn--popup">
  74. <span>🞄</span>
  75. {{ noText(mappedGuests.Language, mappedGuests.Names.length) }}
  76. <span>🞄</span>
  77. </button>
  78. </div>
  79. </div>
  80. </div>
  81. </main>
  82. </template>
  83. <script>
  84. export default {
  85. data: () => ({
  86. guests: {},
  87. allGuests: [],
  88. isPopupVisible: false
  89. }),
  90. computed: {
  91. mappedGuests () {
  92. return this.guests && this.guests.records && this.guests.records[0] && this.guests.records[0].fields
  93. }
  94. },
  95. async fetch () {
  96. const res = await fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(Code='${this.$route.params.code}')`, {
  97. method: 'GET',
  98. headers: {
  99. 'Content-Type': 'application/x-www-form-urlencoded',
  100. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  101. }
  102. })
  103. const json = await res.json()
  104. console.log(json)
  105. this.guests = { ...await json }
  106. const res2 = await fetch('https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(IsActive=1)', {
  107. method: 'GET',
  108. headers: {
  109. 'Content-Type': 'application/x-www-form-urlencoded',
  110. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  111. }
  112. })
  113. const json2 = await res2.json()
  114. console.log(json2)
  115. const guestData = [...await json2 && json2.records]
  116. this.allGuests = await guestData.map((guest) => {
  117. return {
  118. code: guest.fields.Code,
  119. names: guest.fields.Names
  120. }
  121. })
  122. },
  123. methods: {
  124. openPopup () {
  125. this.isPopupVisible = !this.isPopupVisible
  126. },
  127. yesText (lang, count) {
  128. if (lang === 'en') {
  129. return (count > 1 ? 'We' : 'I') + ' will try to make it! 🥳'
  130. } else {
  131. return (count > 1 ? 'Wij zijn ' : 'Ik ben') + ' er (waarschijnlijk) bij! 🥳'
  132. }
  133. },
  134. noText (lang, count) {
  135. if (lang === 'en') {
  136. return 'Sorry, ' + (count > 1 ? 'we' : 'I') + ' definitely can\'t make it. 😞'
  137. } else {
  138. return 'Helaas, ' + (count > 1 ? 'wij zijn' : 'I') + ' er zeker weten niet bij. 😞'
  139. }
  140. },
  141. sayYes () {
  142. this.guests = { ...this.guests, records: { ...this.guests.records[0], fields: { ...this.guests.records[0].fields, Status: 'maybe' } } }
  143. fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(Code='${this.$route.params.code}')`, {
  144. method: 'PATCH',
  145. headers: {
  146. 'Content-Type': 'application/x-www-form-urlencoded',
  147. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  148. },
  149. body: this.guests
  150. }).then((response) => {
  151. console.log(response.status)
  152. return response.json()
  153. }).then(data => console.log(data))
  154. },
  155. sayNo () {
  156. this.guests = { ...this.guests, records: { ...this.guests.records[0], fields: { ...this.guests.records[0].fields, Status: 'nah' } } }
  157. fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(Code='${this.$route.params.code}')`, {
  158. method: 'PATCH',
  159. headers: {
  160. 'Content-Type': 'application/x-www-form-urlencoded',
  161. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  162. },
  163. body: this.guests
  164. }).then((response) => {
  165. console.log(response.status)
  166. return response.json()
  167. }).then(data => console.log(data))
  168. }
  169. }
  170. }
  171. </script>
  172. <style>
  173. html {
  174. font-size: 2vmin;
  175. font-family: "Times New Roman", Times, serif;
  176. color: var(--blue);
  177. }
  178. :root {
  179. --b1: #648bc8;
  180. --b2: #5b6ba6;
  181. --blue: var(--b2);
  182. --lightblue: #b2c6eb;
  183. --bkg: #dfebfe;
  184. }
  185. @font-face {
  186. font-family: "kingthings_petrockregular";
  187. src: url("~assets/fonts/Kingthings_Petrock-webfont.woff") format("woff");
  188. font-weight: normal;
  189. font-style: normal;
  190. }
  191. body {
  192. margin: 0;
  193. }
  194. main {
  195. width: 100vw;
  196. height: 100vh;
  197. background: var(--bkg);
  198. display: flex;
  199. flex-direction: column;
  200. align-items: center;
  201. justify-content: center;
  202. }
  203. h1 {
  204. font-size: 3rem;
  205. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  206. }
  207. p {
  208. font-size: 1.5rem;
  209. }
  210. .img--bkg {
  211. width: 100vw;
  212. object-fit: cover;
  213. height: 100vh;
  214. }
  215. .names {
  216. position: fixed;
  217. padding: 2rem;
  218. aspect-ratio: 1;
  219. background: var(--bkg);
  220. color: var(--blue);
  221. font-size: 2rem;
  222. border-radius: 999px;
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. justify-content: center;
  227. }
  228. .names::before {
  229. content: "";
  230. border: 5px dotted var(--blue);
  231. position: absolute;
  232. border-radius: 999px;
  233. width: 90%;
  234. aspect-ratio: 1;
  235. }
  236. .names::after {
  237. content: "";
  238. border: 5px dashed var(--blue);
  239. position: absolute;
  240. border-radius: 999px;
  241. width: 80%;
  242. aspect-ratio: 1;
  243. }
  244. .test-links {
  245. position: fixed;
  246. top: 1rem;
  247. left: 1rem;
  248. z-index: 2;
  249. }
  250. nav {
  251. position: fixed;
  252. right: 2rem;
  253. top: 2rem;
  254. display: flex;
  255. gap: 1rem;
  256. z-index: 2;
  257. }
  258. .popup-wrapper {
  259. position: fixed;
  260. z-index: 2;
  261. width: 100vw;
  262. height: 100vh;
  263. display: flex;
  264. flex-direction: column;
  265. align-items: center;
  266. justify-content: center;
  267. }
  268. .popup-wrapper::after {
  269. content: "";
  270. position: absolute;
  271. z-index: 3;
  272. width: calc(100vw + 20px);
  273. height: calc(100vh + 20px);
  274. backdrop-filter: blur(10px);
  275. pointer-events: none;
  276. }
  277. .popup {
  278. background: linear-gradient(to right bottom, var(--bkg), var(--lightblue));
  279. border-radius: 0.5rem;
  280. position: relative;
  281. padding: 1rem 3rem 3rem 3rem;
  282. border: 1.5px solid var(--blue);
  283. z-index: 4;
  284. }
  285. .popup::before {
  286. content: "";
  287. position: absolute;
  288. border-radius: 0.5rem;
  289. border: 2px dotted var(--blue);
  290. top: calc(0.2em);
  291. left: 0.2em;
  292. bottom: calc(0.2em);
  293. right: 0.2em;
  294. pointer-events: none;
  295. }
  296. .btn--header {
  297. background: linear-gradient(to right bottom, var(--bkg), var(--lightblue));
  298. color: var(--blue);
  299. padding: 0.5rem 1rem;
  300. font-size: 1.5rem;
  301. border-radius: 0.2em 1em 0.2em 1em;
  302. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  303. font-weight: 800;
  304. border: 1.5px solid var(--blue);
  305. transition: all 0.3s;
  306. cursor: pointer;
  307. position: relative;
  308. text-transform: capitalize;
  309. }
  310. .btn--header:hover {
  311. background: linear-gradient(to right bottom, var(--bkg), var(--blue));
  312. }
  313. .btn--header::before {
  314. content: "";
  315. position: absolute;
  316. border-radius: 0.2em 0.9em 0.2em 0.9em;
  317. border: 2px dotted var(--blue);
  318. top: calc(0.2em);
  319. left: 0.2em;
  320. bottom: calc(0.2em);
  321. right: 0.2em;
  322. }
  323. .buttons {
  324. display: flex;
  325. flex-direction: column;
  326. align-items: center;
  327. gap: 1rem;
  328. }
  329. .btn--popup {
  330. padding: 0.5em 1em;
  331. font-size: 1.5rem;
  332. border-radius: 999rem;
  333. border: none;
  334. color: var(--bkg);
  335. background: linear-gradient(to right bottom, var(--b1), var(--b2));
  336. display: flex;
  337. align-items: center;
  338. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  339. line-height: 1;
  340. cursor: pointer;
  341. }
  342. .btn--popup span:first-child {
  343. display: inline-block;
  344. margin-right: 0.8em;
  345. }
  346. .btn--popup span:last-child {
  347. display: inline-block;
  348. margin-left: 0.8em;
  349. }
  350. ul {
  351. display: flex;
  352. flex-direction: column;
  353. gap: 0.5rem;
  354. }
  355. li {
  356. display: inline-block;
  357. list-style-type: none;
  358. }
  359. li a {
  360. background: var(--bkg);
  361. color: var(--blue);
  362. padding: 0.5em 1em;
  363. border-radius: 999px;
  364. border: 0;
  365. display: inline-block;
  366. font-size: 0.75rem;
  367. }
  368. </style>