25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

386 lines
13 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">Ticketreservierung</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">Noch eine Reservierung aufgeben</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. version="1.1"
  41. id="svg5225"
  42. xml:space="preserve"
  43. width="350.21805"
  44. height="180.67772"
  45. xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  46. xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  47. xmlns="http://www.w3.org/2000/svg"
  48. xmlns:svg="http://www.w3.org/2000/svg"><defs
  49. id="defs5229" /><sodipodi:namedview
  50. id="namedview5227"
  51. pagecolor="#ffffff"
  52. bordercolor="#999999"
  53. borderopacity="1"
  54. inkscape:showpageshadow="0"
  55. inkscape:pageopacity="0"
  56. inkscape:pagecheckerboard="0"
  57. inkscape:deskcolor="#d1d1d1" /><inkscape:clipboard
  58. min="622.8099,381.05079"
  59. max="973.02795,561.72851"
  60. geom-min="622.8099,381.05079"
  61. geom-max="973.02795,561.72851" /><g
  62. id="g5231"
  63. transform="translate(-622.8099,-392.30077)"><path
  64. id="rect666"
  65. style="opacity:1;stroke-width:0;paint-order:stroke fill markers;stop-color:#000000"
  66. 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
  67. aria-label="WILLTEILEN"
  68. id="text1443"
  69. style="font-size:96px;line-height:1.25;letter-spacing:0px;word-spacing:0px"
  70. transform="matrix(0.42672625,0,0,0.42672625,457.42597,276.68463)"><path
  71. 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"
  72. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  73. id="path4358" /><path
  74. d="m 616.44113,451.06763 v -68.53125 h 18.60938 v 68.53125 z"
  75. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  76. id="path4360" /><path
  77. d="m 649.86301,451.06763 v -68.53125 h 18.51562 v 53.57812 h 26.39063 v 14.95313 z"
  78. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  79. id="path4362" /><path
  80. d="m 705.73801,451.06763 v -68.53125 h 18.51562 v 53.57812 h 26.39063 v 14.95313 z"
  81. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  82. id="path4364" /><path
  83. 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"
  84. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  85. id="path4366" /><path
  86. 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"
  87. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  88. id="path4368" /><path
  89. d="m 871.01926,451.06763 v -68.53125 h 18.60937 v 68.53125 z"
  90. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  91. id="path4370" /><path
  92. d="m 904.44113,451.06763 v -68.53125 h 18.51563 v 53.57812 h 26.39062 v 14.95313 z"
  93. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  94. id="path4372" /><path
  95. 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"
  96. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  97. id="path4374" /><path
  98. 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"
  99. style="font-weight:bold;font-family:'Open Sans ExtraBold';-inkscape-font-specification:'Open Sans ExtraBold, Bold'"
  100. id="path4376" /></g></g></svg>
  101. </div>
  102. </div>
  103. </template>
  104. <script>
  105. import VueWordCloud from 'vuewordcloud';
  106. export default {
  107. name: 'App',
  108. data() {
  109. return {
  110. anzeigename: '',
  111. name: '',
  112. email: '',
  113. newsletter: false,
  114. guests: [],
  115. sending: false,
  116. showHelp: false,
  117. selection: null,
  118. selectionText: null,
  119. success: false,
  120. error: false,
  121. }
  122. },
  123. components: {
  124. [VueWordCloud.name]: VueWordCloud,
  125. },
  126. computed: {
  127. nameColors() {
  128. return ['DeepPink', 'Crimson', 'Blue', 'BlueViolet', 'Fuchsia', 'Navy', 'Indigo']
  129. },
  130. words() {
  131. const names = this.guests.map(guest => {
  132. return guest.anzeigename
  133. })
  134. const nameLengths = names.map(name => {
  135. return name.length
  136. })
  137. const maxNameLength = Math.max(...nameLengths)
  138. return this.guests.map(guest => {
  139. const nameLength = guest.anzeigename.length
  140. let size = maxNameLength - nameLength + 12
  141. return [` ${guest.anzeigename} `, size]
  142. })
  143. },
  144. // guestlist() {
  145. // return this.guests.map( (g) => {
  146. // g.name = g.anzeigename
  147. // return g
  148. // })
  149. // }
  150. },
  151. methods: {
  152. async fetchGuests() {
  153. const response = await fetch('http://localhost:1234/guest')
  154. const data = await response.json()
  155. this.guests = data
  156. },
  157. async onClickTheButton() {
  158. if (this.name.length == 0) {
  159. this.showHelp = true
  160. return false
  161. }
  162. this.showHelp = false
  163. this.sending = true
  164. let data = {
  165. anzeigename: this.anzeigename,
  166. name: this.name,
  167. email: this.email,
  168. newsletter: false,
  169. }
  170. const response = await fetch(
  171. 'http://localhost:1234/guest', {
  172. method: 'POST',
  173. headers: {
  174. 'Content-Type': 'application/json',
  175. },
  176. body: JSON.stringify(data),
  177. }
  178. )
  179. if (response.status === 200) {
  180. this.anzeigename = ''
  181. this.name = ''
  182. this.email = ''
  183. this.success = true
  184. this.fetchGuests()
  185. } else {
  186. this.anzeigename = ''
  187. this.name = ''
  188. this.email = ''
  189. this.success = true
  190. this.fetchGuests()
  191. // this.error = true
  192. }
  193. this.sending = false
  194. return false
  195. },
  196. resetForm () {
  197. this.anzeigename = ''
  198. this.name = ''
  199. this.email = ''
  200. this.success = false
  201. },
  202. async share () {
  203. location.href = "#";
  204. location.href = "#teilnehmen";
  205. try {
  206. await navigator.share({ url:"https://okt-28.ck.si/" })
  207. } catch (err) {
  208. console.log(`Error: ${err}`)
  209. }
  210. }
  211. },
  212. mounted() {
  213. this.fetchGuests()
  214. document.addEventListener('selectionchange', () => {
  215. this.selection = document.getSelection()
  216. // console.log(this.selection)
  217. if (this.selection) {
  218. this.selectionText = this.selection.toString()
  219. }
  220. });
  221. // this.$refs.details.$el
  222. },
  223. }
  224. </script>
  225. <style>
  226. /* jetbrains-mono-600 - latin */
  227. @font-face {
  228. font-family: 'JetBrains Mono';
  229. font-style: normal;
  230. font-weight: 600;
  231. src: url('fonts/jetbrains-mono-v13-latin-600.eot'); /* IE9 Compat Modes */
  232. src: local(''),
  233. url('fonts/jetbrains-mono-v13-latin-600.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
  234. url('fonts/jetbrains-mono-v13-latin-600.woff2') format('woff2'), /* Super Modern Browsers */
  235. url('fonts/jetbrains-mono-v13-latin-600.woff') format('woff'), /* Modern Browsers */
  236. url('fonts/jetbrains-mono-v13-latin-600.ttf') format('truetype'), /* Safari, Android, iOS */
  237. url('fonts/jetbrains-mono-v13-latin-600.svg#JetBrainsMono') format('svg'); /* Legacy iOS */
  238. }
  239. ::selection {
  240. color: #fcfa86;
  241. background: #000;
  242. }
  243. body {
  244. background-color: rgb(167, 204, 247);
  245. background-image: url('bg.gif');
  246. background-size: cover;
  247. color: #000;
  248. margin: 0 0 100px;
  249. }
  250. .otf {
  251. width: 100%;
  252. background-color: rgb(167, 204, 247);
  253. background-image: url('bg.gif');
  254. background-size: cover;
  255. }
  256. #app {
  257. font-family: 'JetBrains Mono', monospace;
  258. -webkit-font-smoothing: antialiased;
  259. -moz-osx-font-smoothing: grayscale;
  260. text-align: center;
  261. display: flex;
  262. flex-direction: column;
  263. align-items: center;
  264. }
  265. .otf {
  266. display: flex;
  267. flex-direction: column;
  268. align-items: center;
  269. min-height: 100vh;
  270. position: relative;
  271. }
  272. .input-headline {
  273. color: #000;
  274. font-size: 2.8vh;
  275. margin-bottom: .8vh;
  276. }
  277. .input-form {
  278. display: flex;
  279. flex-direction: column;
  280. width: 100%;
  281. max-width: 800px;
  282. mix-blend-mode: hard-light;
  283. margin-top: 4vh;
  284. }
  285. .input-text,
  286. .input-btn,
  287. .input-cb {
  288. color: #000;
  289. background: #fff;
  290. font-size: 2.8vh;
  291. font-family: 'JetBrains Mono', monospace;
  292. border: 0;
  293. padding: .5em 1em;
  294. line-height: 1.4;
  295. max-width: 100%;
  296. }
  297. .input-btn {
  298. border-top: 2px solid rgb(0, 0, 0);
  299. cursor: pointer;
  300. }
  301. .input-btn:hover {
  302. border-top: 2px solid rgb(207, 207, 207);
  303. color: rgb(87, 87, 87);
  304. background: rgb(255, 255, 255);
  305. }
  306. .input-checkbox {
  307. margin: 0 1em 0 0;
  308. }
  309. @media screen and (max-width: 1000px) {
  310. .form-wrapper {
  311. margin-top: 4em;
  312. }
  313. .input-text,
  314. .input-btn {
  315. width: 100%;
  316. max-width: 100%;
  317. min-width: 0;
  318. text-align: center;
  319. }
  320. .input-form {
  321. position: absolute;
  322. bottom: 0;
  323. display: flex;
  324. flex-direction: column;
  325. }
  326. }
  327. .input-text {
  328. width: auto;
  329. flex-grow: 1;
  330. }
  331. .input-btn {
  332. color: #fff;
  333. background-color: #000000;
  334. }
  335. .details {
  336. color: #fff;
  337. background-color: #000;
  338. font-size: 10vw;
  339. max-width: 80em;
  340. margin: 3% 3% 200px;
  341. padding: 3%;
  342. }
  343. .selection-text {
  344. position: fixed;
  345. z-index: 9999;
  346. font-size: 10vh;
  347. line-height: 1em;
  348. pointer-events: none;
  349. color: #ec4b73;
  350. mix-blend-mode: multiply;
  351. top: 10%;
  352. }
  353. </style>