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.

671 lines
16 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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <main>
  3. <nav v-if="guests">
  4. <img class="mark" :src="require(`@/assets/images/si_mark.svg`)" alt="">
  5. <button
  6. v-if="guests && guests.fields && guests.fields.Language"
  7. class="btn btn--header"
  8. @click="openPopup"
  9. >
  10. <span style="transform: scaleX(-1);"></span>
  11. {{ guests.fields.Language == "en" ? "click here" : "klik hier" }}
  12. <span></span>
  13. </button>
  14. </nav>
  15. <!-- <pre>
  16. {{ guests }}
  17. </pre> -->
  18. <!-- <ul class="test-links">
  19. <li v-for="guest in allGuests" :key="guest.code">
  20. <nuxt-link :to="'/' + guest.code">{{
  21. guest.names.join(" & ")
  22. }}</nuxt-link>
  23. </li>
  24. </ul> -->
  25. <!-- <div class="names">{{ guests.Names }}</div> -->
  26. <!-- <img
  27. class="img--bkg"
  28. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.gif`)"
  29. alt="wrongo-and-peanut"
  30. /> -->
  31. <video
  32. v-if="!!guests"
  33. class="img--bkg"
  34. playsinline
  35. autoplay
  36. loop
  37. muted
  38. id="bgvid"
  39. :poster="require(`@/assets/images/bkgs/poster.png`)"
  40. >
  41. <!-- :poster="require(`@/assets/images/bkgs/poster.png`)" -->
  42. <!-- <source src="polina.webm" type="video/webm"> -->
  43. <source
  44. v-if="!!guests"
  45. :src="require(`@/assets/images/bkgs/${this.$route.params.code}.mp4`)"
  46. type="video/mp4"
  47. />
  48. </video>
  49. <!-- :src="require(`@/assets/images/bkgs/${(guests && guests.fields && guests.fields.Code) ? guests.fields.Code + '.mp4' : 'pim.mp4'}`)" -->
  50. <div class="empty" v-if="!guests">
  51. What's the password?
  52. </div>
  53. <div v-if="isPopupVisible && this.$route.params.code" class="popup-wrapper">
  54. <div class="popup">
  55. <button class="x" @click="openPopup">
  56. <svg
  57. xmlns="http://www.w3.org/2000/svg"
  58. class="icon icon-tabler icon-tabler-x"
  59. width="40"
  60. height="40"
  61. viewBox="0 0 24 24"
  62. stroke-width="3"
  63. stroke="var(--lightblue)"
  64. fill="none"
  65. stroke-linecap="round"
  66. stroke-linejoin="round"
  67. >
  68. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  69. <line x1="18" y1="6" x2="6" y2="18" />
  70. <line x1="6" y1="6" x2="18" y2="18" />
  71. </svg>
  72. </button>
  73. <h1
  74. v-if="
  75. guests &&
  76. guests.fields &&
  77. guests.fields.Language &&
  78. guests.fields.Language === 'en'
  79. "
  80. >
  81. At long last, we have a date!
  82. </h1>
  83. <div
  84. v-if="
  85. guests &&
  86. guests.fields &&
  87. guests.fields.Language &&
  88. guests.fields.Language === 'en'
  89. "
  90. >
  91. <p>
  92. <strong>It took a while, but we eventually decided to cross our fingers and
  93. plan a transatlantic wedding.</strong>
  94. </p>
  95. <p>
  96. My fellow Americans, <br><br>The Netherlands is on the other
  97. side of the world, and air travel is no walk-in-the-park these days.
  98. Nonetheless: you're reading this because you're extremely important to
  99. me, and we would LOVE to share this beautiful little country with you, if only for a few days!
  100. <br><br>
  101. -S
  102. </p>
  103. <p>
  104. Mark your calendars: <em>August 18th, 2022</em>. Stay tuned for lots more details.
  105. </p>
  106. </div>
  107. <h1
  108. v-if="
  109. guests &&
  110. guests.fields &&
  111. guests.fields.Language &&
  112. guests.fields.Language !== 'en'
  113. "
  114. >
  115. Wij gaan de liefde vieren
  116. </h1>
  117. <div
  118. v-if="
  119. guests &&
  120. guests.fields &&
  121. guests.fields.Language &&
  122. guests.fields.Language !== 'en'
  123. "
  124. >
  125. <p
  126. v-if="
  127. guests &&
  128. guests.fields &&
  129. guests.fields.Names &&
  130. guests.fields.Names.length > 1
  131. "
  132. >
  133. Kunnen we met jullie proosten op onze bruiloft op 18 augustus 2022?
  134. </p>
  135. <p
  136. v-if="
  137. guests &&
  138. guests.fields &&
  139. guests.fields.Names &&
  140. guests.fields.Names.length === 1
  141. "
  142. >
  143. Kunnen we met jou proosten op onze bruiloft op 18 augustus 2022?
  144. </p>
  145. </div>
  146. <div class="buttons">
  147. <button
  148. v-if="guests && guests.fields && guests.fields.Language"
  149. @click="sayYes"
  150. :class="[
  151. 'btn',
  152. 'btn--popup',
  153. 'btn--yes',
  154. { 'btn--selected': guests.fields.Status === 'Maybe' },
  155. ]"
  156. >
  157. <svg
  158. xmlns="http://www.w3.org/2000/svg"
  159. class="icon icon-tabler icon-tabler-check"
  160. width="40"
  161. height="40"
  162. viewBox="0 0 24 24"
  163. stroke-width="3"
  164. stroke="#ffffff"
  165. fill="none"
  166. stroke-linecap="round"
  167. stroke-linejoin="round"
  168. >
  169. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  170. <path d="M5 12l5 5l10 -10" />
  171. </svg>
  172. {{ yesText(guests.fields.Language, guests.fields.Names.length) }}
  173. </button>
  174. <button
  175. v-if="guests && guests.fields && guests.fields.Language"
  176. @click="sayNo"
  177. :class="[
  178. 'btn',
  179. 'btn--popup',
  180. 'btn--no',
  181. { 'btn--selected': guests.fields.Status === 'No' },
  182. ]"
  183. >
  184. <svg
  185. xmlns="http://www.w3.org/2000/svg"
  186. class="icon icon-tabler icon-tabler-x"
  187. width="40"
  188. height="40"
  189. viewBox="0 0 24 24"
  190. stroke-width="3"
  191. stroke="#ffffff"
  192. fill="none"
  193. stroke-linecap="round"
  194. stroke-linejoin="round"
  195. >
  196. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  197. <line x1="18" y1="6" x2="6" y2="18" />
  198. <line x1="6" y1="6" x2="18" y2="18" />
  199. </svg>
  200. {{ noText(guests.fields.Language, guests.fields.Names.length) }}
  201. </button>
  202. </div>
  203. <small
  204. v-if="
  205. guests &&
  206. guests.fields &&
  207. guests.fields.Language &&
  208. guests.fields.Language === 'en'
  209. "> ~ official invitation to follow ~ </small>
  210. <small
  211. v-if="
  212. guests &&
  213. guests.fields &&
  214. guests.fields.Language &&
  215. guests.fields.Language !== 'en'
  216. "> ~ de officiële uitnodiging volgt later ~ </small>
  217. <img class="mark" :src="require(`@/assets/images/si_mark2.svg`)" alt="">
  218. </div>
  219. </div>
  220. </main>
  221. </template>
  222. <script>
  223. export default {
  224. data: () => ({
  225. guests: null,
  226. allGuests: [],
  227. isPopupVisible: false,
  228. fetchFields: [
  229. 'Names',
  230. 'Language',
  231. 'Status',
  232. 'Code'
  233. ]
  234. }),
  235. async fetch () {
  236. if (this.$route.params.code) {
  237. const res = await fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(Code='${this.$route.params.code}')${this.fetchFieldsString}`, {
  238. method: 'GET',
  239. headers: {
  240. 'Content-Type': 'application/x-www-form-urlencoded',
  241. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  242. }
  243. })
  244. const json = await res.json()
  245. if (await json.records[0]) {
  246. this.guests = { ...await json.records[0] }
  247. console.log(this.guests)
  248. }
  249. }
  250. // const res2 = await fetch('https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest?filterByFormula=(IsActive=1)&sort[0][field]=Code&sort[0][direction]=asc', {
  251. // method: 'GET',
  252. // headers: {
  253. // 'Content-Type': 'application/x-www-form-urlencoded',
  254. // Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  255. // }
  256. // })
  257. // const json2 = await res2.json()
  258. // console.log(json2)
  259. // const guestData = [...await json2 && json2.records]
  260. // this.allGuests = await guestData.map((guest) => {
  261. // return {
  262. // code: guest.fields.Code,
  263. // names: guest.fields.Names
  264. // }
  265. // })
  266. },
  267. methods: {
  268. openPopup () {
  269. this.isPopupVisible = !this.isPopupVisible
  270. },
  271. yesText (lang, count) {
  272. if (lang === 'en') {
  273. return (count > 1 ? 'We' : 'I') + ' will try to make it! 🥳'
  274. } else {
  275. return (count > 1 ? 'Wij zijn ' : 'Ik ben') + ' er (waarschijnlijk) bij! 🥳'
  276. }
  277. },
  278. noText (lang, count) {
  279. if (lang === 'en') {
  280. return 'Sorry, ' + (count > 1 ? 'we' : 'I') + ' definitely can\'t make it. 😞'
  281. } else {
  282. return 'Helaas, ' + (count > 1 ? 'wij zijn' : 'ik ben') + ' er zeker weten niet bij. 😞'
  283. }
  284. },
  285. async sayYes () {
  286. const updates =
  287. {
  288. fields: {
  289. Status: 'Maybe'
  290. }
  291. }
  292. const res = await fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest/${this.guests.id}`, {
  293. method: 'PATCH',
  294. headers: {
  295. 'Content-Type': 'application/json',
  296. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  297. },
  298. body: JSON.stringify(updates)
  299. })
  300. const json = await res.json()
  301. this.guests = { ...await json }
  302. },
  303. async sayNo () {
  304. const updates =
  305. {
  306. fields: {
  307. Status: 'No'
  308. }
  309. }
  310. const res = await fetch(`https://api.airtable.com/v0/appR5dwqGUe1vBaa9/Guest/${this.guests.id}`, {
  311. method: 'PATCH',
  312. headers: {
  313. 'Content-Type': 'application/json',
  314. Authorization: 'Bearer key8ZVBxVZJL2Wp7y'
  315. },
  316. body: JSON.stringify(updates)
  317. })
  318. const json = await res.json()
  319. this.guests = { ...await json }
  320. }
  321. },
  322. computed: {
  323. fetchFieldsString () {
  324. const vm = this
  325. const array = vm.fetchFields.map((field) => {
  326. return '&fields[]=' + field
  327. })
  328. return array.join('')
  329. }
  330. }
  331. }
  332. </script>
  333. <style>
  334. html {
  335. font-size: max(2vmin, 12pt);
  336. font-family: "Times New Roman", Times, serif;
  337. color: var(--blue);
  338. }
  339. :root {
  340. --b1: #648bc8;
  341. --b2: #5b6ba6;
  342. --blue: var(--b2);
  343. --lightblue: #b2c6eb;
  344. --bkg: #dfebfe;
  345. }
  346. @font-face {
  347. font-family: "kingthings_petrockregular";
  348. src: url("~assets/fonts/Kingthings_Petrock-webfont.woff") format("woff");
  349. font-weight: normal;
  350. font-style: normal;
  351. }
  352. body {
  353. margin: 0;
  354. }
  355. main {
  356. width: 100vw;
  357. height: 100vh;
  358. background: var(--bkg);
  359. display: flex;
  360. flex-direction: column;
  361. align-items: center;
  362. justify-content: center;
  363. }
  364. h1 {
  365. font-size: 2.5rem;
  366. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  367. margin: 1rem 0 0 0;
  368. text-align: center;
  369. }
  370. p {
  371. font-size: 1rem;
  372. }
  373. .img--bkg {
  374. width: 100vw;
  375. object-fit: cover;
  376. height: 100vh;
  377. }
  378. .empty {
  379. width: 100vw;
  380. height: 100vh;
  381. display: flex;
  382. flex-direction: column;
  383. align-items: center;
  384. justify-content: center;
  385. background: var(--bkg);
  386. color: var(--blue);
  387. position: absolute;
  388. }
  389. .names {
  390. position: fixed;
  391. padding: 2rem;
  392. aspect-ratio: 1;
  393. background: var(--bkg);
  394. color: var(--blue);
  395. font-size: 2rem;
  396. border-radius: 999px;
  397. display: flex;
  398. flex-direction: column;
  399. align-items: center;
  400. justify-content: center;
  401. }
  402. .names::before {
  403. content: "";
  404. border: 5px dotted var(--blue);
  405. position: absolute;
  406. border-radius: 999px;
  407. width: 90%;
  408. aspect-ratio: 1;
  409. }
  410. .names::after {
  411. content: "";
  412. border: 5px dashed var(--blue);
  413. position: absolute;
  414. border-radius: 999px;
  415. width: 80%;
  416. aspect-ratio: 1;
  417. }
  418. .test-links {
  419. position: fixed;
  420. top: 1rem;
  421. left: 1rem;
  422. z-index: 2;
  423. }
  424. nav {
  425. position: fixed;
  426. left: 2rem;
  427. right: 2rem;
  428. top: 2rem;
  429. display: flex;
  430. gap: 1rem;
  431. z-index: 2;
  432. justify-content: space-between;
  433. }
  434. .popup-wrapper {
  435. position: fixed;
  436. z-index: 2;
  437. width: 100vw;
  438. height: 100vh;
  439. display: flex;
  440. flex-direction: column;
  441. align-items: center;
  442. justify-content: start;
  443. overflow-y: auto;
  444. overflow-x: hidden;
  445. }
  446. .popup-wrapper::after {
  447. content: "";
  448. position: absolute;
  449. z-index: 3;
  450. width: calc(100vw + 20px);
  451. height: calc(100vh + 20px);
  452. backdrop-filter: blur(10px);
  453. pointer-events: none;
  454. }
  455. .popup {
  456. background: linear-gradient(to right bottom, var(--bkg), var(--lightblue));
  457. border-radius: 0.5rem;
  458. position: relative;
  459. padding: 1rem 3rem 3rem 3rem;
  460. border: 1.5px solid var(--blue);
  461. z-index: 4;
  462. display: flex;
  463. flex-direction: column;
  464. max-width: 60ch;
  465. align-items: center;
  466. margin-top: 10vh;
  467. }
  468. small {
  469. font-size: 1rem;
  470. }
  471. .popup::before {
  472. content: "";
  473. position: absolute;
  474. border-radius: 0.5rem;
  475. border: 2px dotted var(--blue);
  476. top: calc(0.2em);
  477. left: 0.2em;
  478. bottom: calc(0.2em);
  479. right: 0.2em;
  480. pointer-events: none;
  481. }
  482. .btn--header {
  483. background: linear-gradient(to right bottom, var(--bkg), var(--lightblue));
  484. color: var(--blue);
  485. padding: 0.5rem 1rem;
  486. font-size: 1.5rem;
  487. border-radius: 0.2em 1em 0.2em 1em;
  488. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  489. font-weight: 800;
  490. border: 1.5px solid var(--blue);
  491. transition: all 0.3s;
  492. cursor: pointer;
  493. position: relative;
  494. text-transform: capitalize;
  495. line-height: 1.4;
  496. display: flex;
  497. align-items: center;
  498. gap: 0.25em;
  499. }
  500. .btn--header span {
  501. font-size: 1.5rem;
  502. font-family: 'Times New Roman', Times, serif;
  503. }
  504. .btn--header:hover {
  505. background: linear-gradient(to right bottom, var(--bkg), var(--blue));
  506. }
  507. .btn--header::before {
  508. content: "";
  509. position: absolute;
  510. border-radius: 0.2em 0.9em 0.2em 0.9em;
  511. border: 2px dotted var(--blue);
  512. top: calc(0.2em);
  513. left: 0.2em;
  514. bottom: calc(0.2em);
  515. right: 0.2em;
  516. }
  517. .buttons {
  518. margin: 2rem 0 2rem 0;
  519. display: flex;
  520. flex-direction: column;
  521. align-items: stretch;
  522. gap: 1rem;
  523. }
  524. /* .btn--popup {
  525. padding: 0.5em 1em;
  526. font-size: 1.5rem;
  527. border-radius: 999rem;
  528. border: none;
  529. color: var(--bkg);
  530. background: linear-gradient(to right bottom, var(--b1), var(--b2));
  531. display: flex;
  532. align-items: center;
  533. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  534. line-height: 1;
  535. cursor: pointer;
  536. } */
  537. .btn--popup {
  538. padding: 0.5em 1em;
  539. font-size: 1.5rem;
  540. border-radius: 999rem;
  541. border: none;
  542. color: var(--bkg);
  543. background: linear-gradient(to right bottom, var(--b1), var(--b2));
  544. display: flex;
  545. align-items: center;
  546. font-family: "kingthings_petrockregular", "Times New Roman", Times, serif;
  547. line-height: 1;
  548. cursor: pointer;
  549. gap: 1rem;
  550. text-align: left;
  551. }
  552. .btn--popup svg {
  553. height: 2rem;
  554. width: 2rem;
  555. }
  556. .btn--popup span:first-child {
  557. display: inline-block;
  558. margin-right: 0.8em;
  559. }
  560. .btn--popup span:last-child {
  561. display: inline-block;
  562. margin-left: 0.8em;
  563. }
  564. .btn--yes:hover {
  565. background: green;
  566. }
  567. .btn--no:hover {
  568. background: darkred;
  569. }
  570. .btn--selected.btn--yes {
  571. background: green;
  572. }
  573. .btn--selected.btn--no {
  574. background: darkred;
  575. }
  576. .x {
  577. background: transparent;
  578. border: 0;
  579. color: var(--b1);
  580. font-size: 2rem;
  581. align-self: flex-end;
  582. margin-right: -1.5rem;
  583. transition: all 0.2s;
  584. line-height: 0;
  585. border-radius: 999px;
  586. }
  587. .x:hover {
  588. color: var(--b2);
  589. background: var(--b1);
  590. }
  591. ul {
  592. display: flex;
  593. gap: 0.25rem;
  594. flex-flow: column wrap;
  595. height: 90vh;
  596. }
  597. li {
  598. display: inline-block;
  599. list-style-type: none;
  600. }
  601. li a {
  602. background: var(--bkg);
  603. color: var(--blue);
  604. padding: 0.25em 1em;
  605. border-radius: 999px;
  606. border: 0;
  607. display: inline-block;
  608. font-size: 0.75rem;
  609. line-height: 1;
  610. }
  611. .mark {
  612. height: 3rem;
  613. width: 3rem;
  614. opacity: 0.5;
  615. }
  616. .popup .mark {
  617. margin-top: 2rem;
  618. opacity: 1;
  619. }
  620. </style>