Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

340 rindas
12 KiB

  1. <template>
  2. <div id="app">
  3. <div class="selection-text">{{selectionText}}</div>
  4. <div class="otf" id="teilnehmen">
  5. <!-- <h1 style="padding-top:1em">Party</h1> -->
  6. <div class="form-wrapper">
  7. </div>
  8. <form v-if="!success" class="input-form" @submit.prevent="onClickTheButton" style="margin-top: 5vh">
  9. <div class="input-headline">reservation</div>
  10. <input class="input-text" v-model="anzeigename" placeholder="nickname (public)" size="1" />
  11. <input class="input-text" v-model="name" placeholder="real name" size="1" />
  12. <input class="input-text" v-model="email" placeholder="email" size="1" />
  13. <!-- <label class="input-cb" for="newsletter">
  14. <input name="newsletter" id="newsletter" type="checkbox" class="input-checkbox" />stay informed
  15. </label> -->
  16. <input class="input-btn" type="submit" :value="(sending ? 'send ...' : 'reserve')" />
  17. <div v-if="error">oh no something went wrong!</div>
  18. </form>
  19. <div v-if="showHelp" style="margin-bottom: 1em;">
  20. *robot voice* give us your data for the reservation!
  21. </div>
  22. <div v-if="success">
  23. <p style="font-size: 8vw">
  24. Thanks!
  25. </p>
  26. <button @click="resetForm" class="input-btn">✓ see you there!</button>
  27. </div>
  28. <vue-word-cloud class="wordcloud" style="height: 70vh; width: 80%" :words="words"
  29. :color="() => { return nameColors[Math.floor(Math.random() * nameColors.length)] }"
  30. font-family="'JetBrains Mono'" />
  31. </div>
  32. <!-- <div class="details" ref="details">
  33. TEXT!
  34. </div> -->
  35. <div
  36. @click="share"
  37. style="cursor: pointer; margin-top: 5em;"
  38. >
  39. <svg
  40. style="fill: #fff"
  41. version="1.1"
  42. id="svg5225"
  43. xml:space="preserve"
  44. width="350.21805"
  45. height="180.67772"
  46. xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  47. xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  48. xmlns="http://www.w3.org/2000/svg"
  49. xmlns:svg="http://www.w3.org/2000/svg"><defs
  50. id="defs5229" /><sodipodi:namedview
  51. id="namedview5227"
  52. pagecolor="#ffffff"
  53. bordercolor="#999999"
  54. borderopacity="1"
  55. inkscape:showpageshadow="0"
  56. inkscape:pageopacity="0"
  57. inkscape:pagecheckerboard="0"
  58. inkscape:deskcolor="#d1d1d1" /><inkscape:clipboard
  59. min="622.8099,381.05079"
  60. max="973.02795,561.72851"
  61. geom-min="622.8099,381.05079"
  62. geom-max="973.02795,561.72851" /><g
  63. id="g5231"
  64. transform="translate(-622.8099,-392.30077)"><path
  65. id="rect666"
  66. style="opacity:1;stroke-width:0;paint-order:stroke fill markers;"
  67. d="m 659.49419,392.30077 v 16.42729 h -16.29894 v 19.18185 H 622.8099 v 50.60456 h 21.94223 v 18.91764 h 17.1749 v 19.63024 h 55.25355 l -37.05351,55.91614 h 30.5701 l 37.05351,-55.91614 H 938.594 v -16.05974 h 15.9914 v -18.04835 h 18.44255 v -50.6054 h -19.99946 v -20.0503 h -16.86734 v -19.99779 z m 6.9343,23.4191 h 263.36676 v 19.99779 h 19.99946 v 41.86585 h -18.44255 v 16.05974 H 667.98538 v -19.63024 h -21.94223 v -41.86584 h 20.38534 z" /><g
  68. aria-label="WILLTEILEN"
  69. id="text1443"
  70. style="font-size:96px;line-height:1.25;letter-spacing:0px;word-spacing:0px"
  71. transform="matrix(0.42672625,0,0,0.42672625,457.42597,276.68463)"><path
  72. d="m 590.70676,451.06763 h -21.89063 l -6.5625,-29.85938 q -0.46875,-1.875 -1.5,-7.45312 -0.98437,-5.57813 -1.45312,-9.32813 -0.375,3.04688 -1.21875,7.59375 -0.84375,4.5 -1.6875,8.29688 -0.79688,3.79687 -6.79688,30.75 h -21.89062 l -16.96875,-68.53125 h 17.85937 l 7.45313,34.35937 q 2.53125,11.39063 3.46875,18.14063 0.60937,-4.78125 2.15625,-12.98438 1.59375,-8.20312 2.95312,-13.59375 l 6.04688,-25.92187 h 17.15625 l 5.85937,25.92187 q 1.5,6.23438 3.04688,14.39063 1.54687,8.15625 2.0625,12.1875 0.60937,-5.20313 3.32812,-18.04688 l 7.59375,-34.45312 h 17.85938 z"
  73. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  74. id="path4358" /><path
  75. d="m 616.44113,451.06763 v -68.53125 h 18.60938 v 68.53125 z"
  76. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  77. id="path4360" /><path
  78. d="m 649.86301,451.06763 v -68.53125 h 18.51562 v 53.57812 h 26.39063 v 14.95313 z"
  79. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  80. id="path4362" /><path
  81. d="m 705.73801,451.06763 v -68.53125 h 18.51562 v 53.57812 h 26.39063 v 14.95313 z"
  82. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  83. id="path4364" /><path
  84. d="M 791.84738,451.06763 H 773.33176 V 397.677 h -16.73438 v -15.14062 h 51.9375 V 397.677 h -16.6875 z"
  85. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  86. id="path4366" /><path
  87. d="m 859.01926,451.06763 h -40.6875 v -68.53125 h 40.6875 v 14.85937 H 836.84738 V 408.177 h 20.53125 v 14.85938 h -20.53125 v 12.9375 h 22.17188 z"
  88. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  89. id="path4368" /><path
  90. d="m 871.01926,451.06763 v -68.53125 h 18.60937 v 68.53125 z"
  91. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  92. id="path4370" /><path
  93. d="m 904.44113,451.06763 v -68.53125 h 18.51563 v 53.57812 h 26.39062 v 14.95313 z"
  94. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  95. id="path4372" /><path
  96. d="m 1001.0036,451.06763 h -40.68747 v -68.53125 h 40.68747 v 14.85937 H 978.83176 V 408.177 h 20.53125 v 14.85938 h -20.53125 v 12.9375 h 22.17184 z"
  97. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  98. id="path4374" /><path
  99. d="m 1078.2536,451.06763 h -24.2812 l -25.0313,-48.28125 h -0.4218 q 0.8906,11.39062 0.8906,17.39062 v 30.89063 h -16.4063 v -68.53125 h 24.1875 l 24.9375,47.625 h 0.2813 q -0.6563,-10.35938 -0.6563,-16.64063 v -30.98437 h 16.5 z"
  100. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  101. id="path4376" /></g></g></svg>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import VueWordCloud from 'vuewordcloud';
  107. export default {
  108. name: 'App',
  109. data() {
  110. return {
  111. anzeigename: '',
  112. name: '',
  113. email: '',
  114. newsletter: false,
  115. guests: [],
  116. sending: false,
  117. showHelp: false,
  118. selection: null,
  119. selectionText: null,
  120. success: false,
  121. error: false,
  122. }
  123. },
  124. components: {
  125. [VueWordCloud.name]: VueWordCloud,
  126. },
  127. computed: {
  128. nameColors() {
  129. return ['DeepPink', 'Crimson', 'Blue', 'BlueViolet', 'Fuchsia', 'Navy', 'Indigo']
  130. },
  131. words() {
  132. const names = this.guests.map(guest => {
  133. return guest.anzeigename
  134. })
  135. const nameLengths = names.map(name => {
  136. return name.length
  137. })
  138. const maxNameLength = Math.max(...nameLengths)
  139. return this.guests.map(guest => {
  140. const nameLength = guest.anzeigename.length
  141. let size = maxNameLength - nameLength + 12
  142. return [` ${guest.anzeigename} `, size]
  143. })
  144. },
  145. // guestlist() {
  146. // return this.guests.map( (g) => {
  147. // g.name = g.anzeigename
  148. // return g
  149. // })
  150. // }
  151. },
  152. methods: {
  153. async fetchGuests() {
  154. const response = await fetch('/api/guest')
  155. const data = await response.json()
  156. this.guests = data
  157. },
  158. async onClickTheButton() {
  159. if (this.name.length == 0) {
  160. this.showHelp = true
  161. return false
  162. }
  163. this.showHelp = false
  164. this.sending = true
  165. let data = {
  166. anzeigename: this.anzeigename,
  167. name: this.name,
  168. email: this.email,
  169. newsletter: false,
  170. }
  171. const response = await fetch(
  172. '/api/guest', {
  173. method: 'POST',
  174. headers: {
  175. 'Content-Type': 'application/json',
  176. },
  177. body: JSON.stringify(data),
  178. }
  179. )
  180. if (response.status === 200) {
  181. this.anzeigename = ''
  182. this.name = ''
  183. this.email = ''
  184. this.success = true
  185. this.fetchGuests()
  186. } else {
  187. this.anzeigename = ''
  188. this.name = ''
  189. this.email = ''
  190. this.success = true
  191. this.fetchGuests()
  192. // this.error = true
  193. }
  194. this.sending = false
  195. return false
  196. },
  197. resetForm () {
  198. this.anzeigename = ''
  199. this.name = ''
  200. this.email = ''
  201. this.success = false
  202. },
  203. async share () {
  204. location.href = "#";
  205. location.href = "#teilnehmen";
  206. try {
  207. await navigator.share({ url:"https://reservation.ck.si/" })
  208. } catch (err) {
  209. console.log(`Error: ${err}`)
  210. }
  211. }
  212. },
  213. mounted() {
  214. this.fetchGuests()
  215. document.addEventListener('selectionchange', () => {
  216. this.selection = document.getSelection()
  217. // console.log(this.selection)
  218. if (this.selection) {
  219. this.selectionText = this.selection.toString()
  220. }
  221. });
  222. // this.$refs.details.$el
  223. },
  224. }
  225. </script>
  226. <style>
  227. .otf {
  228. width: 100%;
  229. /* background-color: rgb(167, 204, 247); */
  230. /* background-image: url('bg.gif'); */
  231. background-size: cover;
  232. display: flex;
  233. flex-direction: column;
  234. align-items: center;
  235. min-height: 100vh;
  236. position: relative;
  237. }
  238. .input-headline {
  239. color: rgb(255, 255, 255);
  240. font-size: 2.8vh;
  241. margin-bottom: .8vh;
  242. }
  243. .input-form {
  244. display: flex;
  245. flex-direction: column;
  246. width: 100%;
  247. max-width: 800px;
  248. mix-blend-mode: exclusion;
  249. margin-top: 4vh;
  250. z-index: 9;
  251. position: relative;
  252. }
  253. .input-text,
  254. .input-btn,
  255. .input-cb {
  256. color: #000;
  257. background: #fff;
  258. font-size: 2.8vh;
  259. font-family: 'JetBrains Mono', monospace;
  260. border: 0;
  261. padding: .5em 1em;
  262. line-height: 1.4;
  263. max-width: 100%;
  264. }
  265. .input-btn {
  266. color: #fff;
  267. background-color: #1e3a8e;
  268. border-top: 2px solid rgb(0, 0, 0);
  269. cursor: pointer;
  270. }
  271. .input-btn:hover {
  272. color: rgb(87, 87, 87);
  273. background: rgb(255, 255, 255);
  274. border-top: 2px solid rgb(207, 207, 207);
  275. }
  276. .input-checkbox {
  277. margin: 0 1em 0 0;
  278. }
  279. @media screen and (max-width: 1000px) {
  280. .form-wrapper {
  281. margin-top: 4em;
  282. }
  283. .input-text,
  284. .input-btn {
  285. width: 100%;
  286. max-width: 100%;
  287. min-width: 0;
  288. text-align: center;
  289. }
  290. /* .input-form {
  291. position: absolute;
  292. bottom: 0;
  293. display: flex;
  294. flex-direction: column;
  295. } */
  296. }
  297. .input-text {
  298. width: auto;
  299. flex-grow: 1;
  300. }
  301. .details {
  302. color: #fff;
  303. background-color: #000;
  304. font-size: 10vw;
  305. max-width: 80em;
  306. margin: 3% 3% 200px;
  307. padding: 3%;
  308. }
  309. .selection-text {
  310. position: fixed;
  311. z-index: 9999;
  312. font-size: 10vh;
  313. line-height: 1em;
  314. pointer-events: none;
  315. color: #ec4b73;
  316. mix-blend-mode: multiply;
  317. top: 10%;
  318. }
  319. </style>