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.

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