mirror of
https://github.com/RustyRaptor/schej.it.git
synced 2026-12-03 15:55:18 -07:00
Weekly schej (#32)
Co-authored-by: Tony Xin <32372239+TtonyxX@users.noreply.github.com>
This commit is contained in:
1 parent
42fe58ee7e
commit
cf03fb8837
51 files changed
+963
-821
No files matched your search
@@ -0,0 +1,3 @@
|
||||
dist
|
||||
node_modules
|
||||
.vscode
|
||||
@@ -1,19 +1,23 @@
|
||||
# schej
|
||||
|
||||
## Project setup
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
@@ -1,5 +1,3 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
presets: ["@vue/cli-plugin-babel/preset"],
|
||||
}
|
||||
@@ -5,15 +5,8 @@
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
"@/*": ["src/*"]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"]
|
||||
}
|
||||
}
|
||||
Generated
+100
-19
@@ -11,9 +11,9 @@
|
||||
"@gtm-support/vue2-gtm": "^2.0.0",
|
||||
"copy-image-clipboard": "^2.1.2",
|
||||
"core-js": "^3.8.3",
|
||||
"dayjs": "^1.11.9",
|
||||
"html2canvas": "^1.4.1",
|
||||
"is-ua-webview": "^1.1.0",
|
||||
"long-press-event": "^2.4.4",
|
||||
"register-service-worker": "^1.7.2",
|
||||
"tsparticles-confetti": "^2.9.3",
|
||||
"ua-parser-js": "^1.0.33",
|
||||
@@ -33,6 +33,8 @@
|
||||
"@vue/cli-service": "~5.0.8",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"postcss": "^8.4.13",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"sass": "~1.32.0",
|
||||
"sass-loader": "^10.0.0",
|
||||
"tailwindcss": "^3.0.24",
|
||||
@@ -4634,6 +4636,11 @@
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz",
|
||||
"integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.9",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz",
|
||||
"integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA=="
|
||||
},
|
||||
"node_modules/de-indent": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
|
||||
@@ -7335,11 +7342,6 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/long-press-event": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/long-press-event/-/long-press-event-2.4.4.tgz",
|
||||
"integrity": "sha512-6ZtRiZJCLgxr6UdbyEtrBZgOdwqbFdhm6mDo4TtwC8lFuODe9tvUNNIhzpht1m9jHrDyzMfpVyKIzJAFnEUXtQ=="
|
||||
},
|
||||
"node_modules/lower-case": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||
@@ -8965,11 +8967,10 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz",
|
||||
"integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==",
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
||||
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
@@ -8980,6 +8981,80 @@
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier-plugin-tailwindcss": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.3.0.tgz",
|
||||
"integrity": "sha512-009/Xqdy7UmkcTBpwlq7jsViDqXAYSOMLDrHAdTMlVZOrKfM2o9Ci7EMWTMZ7SkKBFTG04UM9F9iM2+4i6boDA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.17.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@ianvs/prettier-plugin-sort-imports": "*",
|
||||
"@prettier/plugin-pug": "*",
|
||||
"@shopify/prettier-plugin-liquid": "*",
|
||||
"@shufo/prettier-plugin-blade": "*",
|
||||
"@trivago/prettier-plugin-sort-imports": "*",
|
||||
"prettier": ">=2.2.0",
|
||||
"prettier-plugin-astro": "*",
|
||||
"prettier-plugin-css-order": "*",
|
||||
"prettier-plugin-import-sort": "*",
|
||||
"prettier-plugin-jsdoc": "*",
|
||||
"prettier-plugin-marko": "*",
|
||||
"prettier-plugin-organize-attributes": "*",
|
||||
"prettier-plugin-organize-imports": "*",
|
||||
"prettier-plugin-style-order": "*",
|
||||
"prettier-plugin-svelte": "*",
|
||||
"prettier-plugin-twig-melody": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@ianvs/prettier-plugin-sort-imports": {
|
||||
"optional": true
|
||||
},
|
||||
"@prettier/plugin-pug": {
|
||||
"optional": true
|
||||
},
|
||||
"@shopify/prettier-plugin-liquid": {
|
||||
"optional": true
|
||||
},
|
||||
"@shufo/prettier-plugin-blade": {
|
||||
"optional": true
|
||||
},
|
||||
"@trivago/prettier-plugin-sort-imports": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-astro": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-css-order": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-import-sort": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-jsdoc": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-marko": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-organize-attributes": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-organize-imports": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-style-order": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-svelte": {
|
||||
"optional": true
|
||||
},
|
||||
"prettier-plugin-twig-melody": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-bytes": {
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
|
||||
@@ -15779,6 +15854,11 @@
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.1.tgz",
|
||||
"integrity": "sha512-DJR/VvkAvSZW9bTouZue2sSxDwdTN92uHjqeKVm+0dAqdfNykRzQ95tay8aXMBAAPpUiq4Qcug2L7neoRh2Egw=="
|
||||
},
|
||||
"dayjs": {
|
||||
"version": "1.11.9",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.9.tgz",
|
||||
"integrity": "sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA=="
|
||||
},
|
||||
"de-indent": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
|
||||
@@ -17798,11 +17878,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"long-press-event": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/long-press-event/-/long-press-event-2.4.4.tgz",
|
||||
"integrity": "sha512-6ZtRiZJCLgxr6UdbyEtrBZgOdwqbFdhm6mDo4TtwC8lFuODe9tvUNNIhzpht1m9jHrDyzMfpVyKIzJAFnEUXtQ=="
|
||||
},
|
||||
"lower-case": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||
@@ -18926,11 +19001,17 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.6.2.tgz",
|
||||
"integrity": "sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==",
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
|
||||
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-plugin-tailwindcss": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.3.0.tgz",
|
||||
"integrity": "sha512-009/Xqdy7UmkcTBpwlq7jsViDqXAYSOMLDrHAdTMlVZOrKfM2o9Ci7EMWTMZ7SkKBFTG04UM9F9iM2+4i6boDA==",
|
||||
"dev": true,
|
||||
"optional": true
|
||||
"requires": {}
|
||||
},
|
||||
"pretty-bytes": {
|
||||
"version": "5.6.0",
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
"@gtm-support/vue2-gtm": "^2.0.0",
|
||||
"copy-image-clipboard": "^2.1.2",
|
||||
"core-js": "^3.8.3",
|
||||
"dayjs": "^1.11.9",
|
||||
"html2canvas": "^1.4.1",
|
||||
"is-ua-webview": "^1.1.0",
|
||||
"long-press-event": "^2.4.4",
|
||||
"register-service-worker": "^1.7.2",
|
||||
"tsparticles-confetti": "^2.9.3",
|
||||
"ua-parser-js": "^1.0.33",
|
||||
@@ -32,6 +32,8 @@
|
||||
"@vue/cli-service": "~5.0.8",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"postcss": "^8.4.13",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"sass": "~1.32.0",
|
||||
"sass-loader": "^10.0.0",
|
||||
"tailwindcss": "^3.0.24",
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<script src="<%= BASE_URL %>js/long-press-event.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/*!
|
||||
* long-press-event - v2.4.4
|
||||
* Pure JavaScript long-press-event
|
||||
* https://github.com/john-doherty/long-press-event
|
||||
* @author John Doherty <www.johndoherty.info>
|
||||
* @license MIT
|
||||
*/
|
||||
!function(e,t){"use strict";var n=null,a="PointerEvent"in e||e.navigator&&"msPointerEnabled"in e.navigator,i="ontouchstart"in e||navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0,o=a?"pointerdown":i?"touchstart":"mousedown",r=a?"pointerup":i?"touchend":"mouseup",m=a?"pointermove":i?"touchmove":"mousemove",u=0,s=0,c=10,l=10;function v(e){f(),e=function(e){if(void 0!==e.changedTouches)return e.changedTouches[0];return e}(e),this.dispatchEvent(new CustomEvent("long-press",{bubbles:!0,cancelable:!0,detail:{clientX:e.clientX,clientY:e.clientY},clientX:e.clientX,clientY:e.clientY,offsetX:e.offsetX,offsetY:e.offsetY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}))||t.addEventListener("click",function e(n){t.removeEventListener("click",e,!0),function(e){e.stopImmediatePropagation(),e.preventDefault(),e.stopPropagation()}(n)},!0)}function d(a){f(a);var i=a.target,o=parseInt(function(e,n,a){for(;e&&e!==t.documentElement;){var i=e.getAttribute(n);if(i)return i;e=e.parentNode}return a}(i,"data-long-press-delay","1500"),10);n=function(t,n){if(!(e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame&&e.mozCancelRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame))return e.setTimeout(t,n);var a=(new Date).getTime(),i={},o=function(){(new Date).getTime()-a>=n?t.call():i.value=requestAnimFrame(o)};return i.value=requestAnimFrame(o),i}(v.bind(i,a),o)}function f(t){var a;(a=n)&&(e.cancelAnimationFrame?e.cancelAnimationFrame(a.value):e.webkitCancelAnimationFrame?e.webkitCancelAnimationFrame(a.value):e.webkitCancelRequestAnimationFrame?e.webkitCancelRequestAnimationFrame(a.value):e.mozCancelRequestAnimationFrame?e.mozCancelRequestAnimationFrame(a.value):e.oCancelRequestAnimationFrame?e.oCancelRequestAnimationFrame(a.value):e.msCancelRequestAnimationFrame?e.msCancelRequestAnimationFrame(a.value):clearTimeout(a)),n=null}"function"!=typeof e.CustomEvent&&(e.CustomEvent=function(e,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=t.createEvent("CustomEvent");return a.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),a},e.CustomEvent.prototype=e.Event.prototype),e.requestAnimFrame=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){e.setTimeout(t,1e3/60)},t.addEventListener(r,f,!0),t.addEventListener(m,function(e){var t=Math.abs(u-e.clientX),n=Math.abs(s-e.clientY);(t>=c||n>=l)&&f()},!0),t.addEventListener("wheel",f,!0),t.addEventListener("scroll",f,!0),t.addEventListener(o,function(e){u=e.clientX,s=e.clientY,d(e)},!0)}(window,document);
|
||||
+14
-20
@@ -5,21 +5,22 @@
|
||||
<SignInNotSupportedDialog v-model="webviewDialog" />
|
||||
<div
|
||||
v-if="showHeader"
|
||||
class="tw-h-14 sm:tw-h-16 tw-bg-white tw-fixed tw-w-screen tw-z-40"
|
||||
class="tw-fixed tw-z-40 tw-h-14 tw-w-screen tw-bg-white sm:tw-h-16"
|
||||
dark
|
||||
>
|
||||
<div
|
||||
class="tw-relative tw-px-4 tw-flex tw-items-center tw-justify-center tw-max-w-6xl tw-h-full tw-m-auto"
|
||||
class="tw-relative tw-m-auto tw-flex tw-h-full tw-max-w-6xl tw-items-center tw-justify-center tw-px-4"
|
||||
>
|
||||
<v-img
|
||||
@click="goHome"
|
||||
alt="Schej Logo"
|
||||
class="shrink tw-cursor-pointer"
|
||||
contain
|
||||
src="@/assets/schej_logo_with_text.png"
|
||||
transition="scale-transition"
|
||||
:width="isPhone ? 70 : 90"
|
||||
/>
|
||||
<router-link :to="{ name: 'home' }">
|
||||
<v-img
|
||||
alt="Schej Logo"
|
||||
class="shrink tw-cursor-pointer"
|
||||
contain
|
||||
src="@/assets/schej_logo_with_text.png"
|
||||
transition="scale-transition"
|
||||
:width="isPhone ? 70 : 90"
|
||||
/>
|
||||
</router-link>
|
||||
|
||||
<v-spacer />
|
||||
|
||||
@@ -31,9 +32,9 @@
|
||||
</div>
|
||||
|
||||
<v-main>
|
||||
<div class="tw-h-screen tw-flex tw-flex-col">
|
||||
<div class="tw-flex tw-h-screen tw-flex-col">
|
||||
<div
|
||||
class="tw-flex-1 tw-relative tw-overscroll-auto"
|
||||
class="tw-relative tw-flex-1 tw-overscroll-auto"
|
||||
:class="routerViewClass"
|
||||
>
|
||||
<router-view v-if="loaded" />
|
||||
@@ -145,13 +146,6 @@ export default {
|
||||
|
||||
methods: {
|
||||
...mapMutations(["setAuthUser"]),
|
||||
goHome() {
|
||||
if (this.$route.name !== "home") {
|
||||
this.$router.push({ name: "home" })
|
||||
} else {
|
||||
location.reload()
|
||||
}
|
||||
},
|
||||
handleScroll(e) {
|
||||
this.scrollY = window.scrollY
|
||||
},
|
||||
|
||||
@@ -1,31 +1,22 @@
|
||||
<template>
|
||||
<v-snackbar
|
||||
v-model="show"
|
||||
top
|
||||
:color="color"
|
||||
>
|
||||
<span class="tw-text-sm tw-mr-2">{{ text }}</span>
|
||||
<v-snackbar v-model="show" top :color="color">
|
||||
<span class="tw-mr-2 tw-text-sm">{{ text }}</span>
|
||||
|
||||
<template v-slot:action="{ attrs }">
|
||||
<v-btn
|
||||
v-bind="attrs"
|
||||
icon
|
||||
@click="show = false"
|
||||
>
|
||||
<v-btn v-bind="attrs" icon @click="show = false">
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
</v-snackbar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'AutoSnackbar',
|
||||
|
||||
name: "AutoSnackbar",
|
||||
|
||||
props: {
|
||||
text: {type: String, default: ''},
|
||||
color: {type: String, default: ''}
|
||||
text: { type: String, default: "" },
|
||||
color: { type: String, default: "" },
|
||||
},
|
||||
|
||||
data() {
|
||||
@@ -42,10 +33,9 @@ export default {
|
||||
handler(text) {
|
||||
if (text) {
|
||||
this.show = true
|
||||
} else
|
||||
this.show = false
|
||||
} else this.show = false
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
@@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<v-scale-transition appear origin="center">
|
||||
<v-btn
|
||||
<v-btn
|
||||
fab
|
||||
fixed
|
||||
class="tw-bg-green tw-mx-auto tw-left-0 tw-right-0 tw-bottom-4 sm:tw-bottom-8 tw-text-white"
|
||||
@click="e => $emit('click', e)"
|
||||
class="tw-left-0 tw-right-0 tw-bottom-4 tw-mx-auto tw-bg-green tw-text-white sm:tw-bottom-8"
|
||||
@click="(e) => $emit('click', e)"
|
||||
v-bind="$attrs"
|
||||
>
|
||||
<slot />
|
||||
</v-btn>
|
||||
</v-scale-transition>
|
||||
</v-scale-transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'BottomFab',
|
||||
name: "BottomFab",
|
||||
|
||||
emits: ['click'],
|
||||
emits: ["click"],
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
@@ -2,7 +2,7 @@
|
||||
<v-container
|
||||
@click="$emit('click')"
|
||||
v-ripple
|
||||
class="hover:tw-drop-shadow-md tw-drop-shadow tw-transition-all tw-bg-white tw-rounded-lg tw-flex tw-text-black tw-justify-between tw-items-center tw-px-4 tw-py-2.5 sm:tw-py-3"
|
||||
class="tw-flex tw-items-center tw-justify-between tw-rounded-lg tw-bg-white tw-px-4 tw-py-2.5 tw-text-black tw-drop-shadow tw-transition-all hover:tw-drop-shadow-md sm:tw-py-3"
|
||||
>
|
||||
<div class="tw-ml-1">
|
||||
<div>{{ this.event.name }}</div>
|
||||
@@ -11,7 +11,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tw-min-w-max">
|
||||
<v-chip small class="tw-text-very-dark-gray tw-m-0.5 tw-bg-off-white">
|
||||
<v-chip small class="tw-m-0.5 tw-bg-off-white tw-text-very-dark-gray">
|
||||
<v-icon left small> mdi-account-multiple </v-icon>
|
||||
{{ Object.keys(this.event.responses).length }}
|
||||
</v-chip>
|
||||
@@ -35,7 +35,7 @@
|
||||
<v-btn
|
||||
id="delete-event-btn"
|
||||
text
|
||||
class="tw-px-6 red--text"
|
||||
class="red--text tw-px-6"
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
block
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- Displays an event type (i.e. created or joined) on the home page -->
|
||||
<template>
|
||||
<div class="tw-mb-5">
|
||||
<div class="tw-text-xl sm:tw-text-2xl tw-font-medium tw-text-dark-green">
|
||||
<div class="tw-text-xl tw-font-medium tw-text-dark-green sm:tw-text-2xl">
|
||||
{{ eventType.header }}
|
||||
</div>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="tw-grid tw-gr id-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-2 tw-gap-3 tw-my-3"
|
||||
class="tw-gr id-cols-1 tw-my-3 tw-grid tw-gap-3 sm:tw-grid-cols-2 md:tw-grid-cols-2"
|
||||
>
|
||||
<EventItem
|
||||
class="tw-cursor-pointer"
|
||||
@@ -26,7 +26,7 @@
|
||||
<v-expand-transition>
|
||||
<div
|
||||
v-if="showAll"
|
||||
class="tw-grid tw-gr id-cols-1 sm:tw-grid-cols-2 md:tw-grid-cols-2 tw-gap-2 sm:tw-gap-4"
|
||||
class="tw-gr id-cols-1 tw-grid tw-gap-2 sm:tw-grid-cols-2 sm:tw-gap-4 md:tw-grid-cols-2"
|
||||
>
|
||||
<EventItem
|
||||
v-for="(event, i) in sortedEvents.slice(
|
||||
@@ -42,7 +42,7 @@
|
||||
</v-expand-transition>
|
||||
<div
|
||||
@click="toggleShowAll"
|
||||
class="tw-cursor-pointer tw-text-very-dark-gray tw-text-sm tw-mt-4"
|
||||
class="tw-mt-4 tw-cursor-pointer tw-text-sm tw-text-very-dark-gray"
|
||||
>
|
||||
Show {{ showAll ? "less" : "more"
|
||||
}}<v-icon :class="showAll && 'tw-rotate-180'">mdi-chevron-down</v-icon>
|
||||
@@ -77,23 +77,8 @@ export default {
|
||||
: this.DEFAULT_NUM_EVENTS_TO_SHOW
|
||||
},
|
||||
sortedEvents() {
|
||||
const sorted = [...this.eventType.events]
|
||||
sorted.sort((a, b) => {
|
||||
let aStartDate, bStartDate
|
||||
if (a.dates && a.dates.length > 0) {
|
||||
aStartDate = a.dates[0]
|
||||
} else {
|
||||
aStartDate = a.startDate
|
||||
}
|
||||
if (b.dates && b.dates.length > 0) {
|
||||
bStartDate = b.dates[0]
|
||||
} else {
|
||||
bStartDate = b.startDate
|
||||
}
|
||||
|
||||
return new Date(bStartDate) - new Date(aStartDate)
|
||||
})
|
||||
return sorted
|
||||
// Events are sorted serverside, so no need to sort here
|
||||
return this.eventType.events
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -2,28 +2,36 @@
|
||||
<div
|
||||
:class="`${
|
||||
toggled ? 'tw-border-green' : 'tw-border-gray'
|
||||
} tw-w-full tw-transition-all tw-flex tw-flex-col tw-text-left tw-border-[1px] tw-p-4 sm:tw-p-6 tw-rounded-md tw-overflow-hidden tw-cursor-pointer`"
|
||||
} tw-flex tw-w-full tw-cursor-pointer tw-flex-col tw-overflow-hidden tw-rounded-md tw-border-[1px] tw-p-4 tw-text-left tw-transition-all sm:tw-p-6`"
|
||||
@click="() => (toggled = !toggled)"
|
||||
>
|
||||
<div
|
||||
class="tw-flex tw-flex-row tw-justify-between tw-content-center sm:tw-text-lg"
|
||||
class="tw-flex tw-flex-row tw-content-center tw-justify-between sm:tw-text-lg"
|
||||
>
|
||||
<div class="tw-font-medium tw-mr-4">{{ question }}</div>
|
||||
<div class="tw-mr-4 tw-font-medium">{{ question }}</div>
|
||||
<v-icon
|
||||
size="x-large"
|
||||
:class="`${
|
||||
toggled ? 'tw-rotate-45 tw-text-green' : 'tw-rotate-0 tw-text-gray'
|
||||
}`"
|
||||
>mdi-plus</v-icon>
|
||||
>mdi-plus</v-icon
|
||||
>
|
||||
</div>
|
||||
|
||||
<v-expand-transition>
|
||||
<div v-if="toggled">
|
||||
<div class="sm:tw-text-lg tw-pt-4 sm:tw-pt-6">
|
||||
<div class="tw-pt-4 sm:tw-pt-6 sm:tw-text-lg">
|
||||
<div>{{ answer }}</div>
|
||||
<div class="tw-gap-2 tw-flex tw-flex-col">
|
||||
<div v-for="(point, index) in points" class="tw-flex tw-items-center">
|
||||
<div class="tw-w-5 tw-h-5 tw-mr-2 tw-shrink-0 tw-bg-green tw-text-white tw-rounded-full tw-flex tw-items-center tw-justify-center">{{ index + 1 }}</div>
|
||||
<div class="tw-flex tw-flex-col tw-gap-2">
|
||||
<div
|
||||
v-for="(point, index) in points"
|
||||
class="tw-flex tw-items-center"
|
||||
>
|
||||
<div
|
||||
class="tw-mr-2 tw-flex tw-h-5 tw-w-5 tw-shrink-0 tw-items-center tw-justify-center tw-rounded-full tw-bg-green tw-text-white"
|
||||
>
|
||||
{{ index + 1 }}
|
||||
</div>
|
||||
<div>{{ point }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
<v-container
|
||||
@click="$emit('click')"
|
||||
v-ripple
|
||||
class="tw-bg-light-gray tw-rounded-md tw-flex tw-text-black tw-justify-between tw-align-middle tw-py-2"
|
||||
class="tw-flex tw-justify-between tw-rounded-md tw-bg-light-gray tw-py-2 tw-align-middle tw-text-black"
|
||||
>
|
||||
<div class="tw-flex">
|
||||
<div class="tw-mr-3">
|
||||
<v-avatar>
|
||||
<img v-if="!friend.picture" src="https://cdn.vuetifyjs.com/images/john.jpg" />
|
||||
<img
|
||||
v-if="!friend.picture"
|
||||
src="https://cdn.vuetifyjs.com/images/john.jpg"
|
||||
/>
|
||||
<img v-else :src="friend.picture" />
|
||||
</v-avatar>
|
||||
</div>
|
||||
@@ -17,11 +20,11 @@
|
||||
Currently
|
||||
<span
|
||||
v-if="this.friend.status == 'free'"
|
||||
class="tw-text-green tw-font-bold"
|
||||
class="tw-font-bold tw-text-green"
|
||||
>free</span
|
||||
><span v-else>
|
||||
in
|
||||
<span class="tw-text-light-blue tw-font-bold">
|
||||
in
|
||||
<span class="tw-font-bold tw-text-light-blue">
|
||||
{{ this.friend.status }}
|
||||
</span>
|
||||
</span>
|
||||
@@ -36,7 +39,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FriendItem',
|
||||
name: "FriendItem",
|
||||
|
||||
props: {
|
||||
friend: { type: Object, required: true },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div
|
||||
class="tw-text-2xl sm:tw-text-3xl lg:tw-text-4xl tw-font-medium tw-mb-4 md:tw-mb-8"
|
||||
class="tw-mb-4 tw-text-2xl tw-font-medium sm:tw-text-3xl md:tw-mb-8 lg:tw-text-4xl"
|
||||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
@@ -9,5 +9,5 @@
|
||||
<script>
|
||||
export default {
|
||||
name: "Header",
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -1,13 +1,9 @@
|
||||
<template>
|
||||
<v-card class="tw-m-4 lg:tw-w-[34rem] tw-rounded-lg">
|
||||
<v-card class="tw-m-4 tw-rounded-lg lg:tw-w-[34rem]">
|
||||
<div class="-tw-ml-3 sm:tw-ml-0">
|
||||
<ScheduleOverlap
|
||||
ref="scheduleOverlap"
|
||||
:dates="dates"
|
||||
:duration="duration"
|
||||
:startTime="startTime"
|
||||
:endTime="endTime"
|
||||
:responses="responses"
|
||||
:event="event"
|
||||
:calendarEventsByDay="calendarEventsByDay"
|
||||
calendarOnly
|
||||
:interactable="false"
|
||||
@@ -50,6 +46,15 @@ export default {
|
||||
}),
|
||||
|
||||
computed: {
|
||||
event() {
|
||||
return {
|
||||
dates: this.dates,
|
||||
duration: this.duration,
|
||||
startTime: this.startTime,
|
||||
endTime: this.endTime,
|
||||
responses: this.responses,
|
||||
}
|
||||
},
|
||||
duration() {
|
||||
return isPhone(this.$vuetify) ? 8 : 13
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
width="400"
|
||||
content-class="tw-m-0"
|
||||
>
|
||||
<v-card class="sm:tw-p-6 tw-p-4">
|
||||
<v-card class="tw-p-4 sm:tw-p-6">
|
||||
<v-expand-transition>
|
||||
<div v-show="state === states.CHOICES">
|
||||
<div class="tw-text-md tw-pb-4 tw-text-center">
|
||||
@@ -15,11 +15,11 @@
|
||||
<div class="">
|
||||
<v-btn
|
||||
@click="showPermissions"
|
||||
class="tw-bg-green tw-mb-2"
|
||||
class="tw-mb-2 tw-bg-green"
|
||||
dark
|
||||
block
|
||||
>
|
||||
<div class="tw-text-sm -tw-mx-4">
|
||||
<div class="-tw-mx-4 tw-text-sm">
|
||||
Automatically with Google Calendar
|
||||
</div>
|
||||
</v-btn>
|
||||
@@ -29,12 +29,12 @@
|
||||
</v-expand-transition>
|
||||
<v-expand-transition>
|
||||
<div v-show="state === states.PERMISSIONS">
|
||||
<div class="tw-text-md tw-font-medium tw-mb-4">
|
||||
<div class="tw-text-md tw-mb-4 tw-font-medium">
|
||||
We need the following permissions to access your Google Calendar
|
||||
events
|
||||
</div>
|
||||
|
||||
<div class="tw-flex tw-flex-col tw-gap-4 tw-mb-8 tw-ml-4">
|
||||
<div class="tw-mb-8 tw-ml-4 tw-flex tw-flex-col tw-gap-4">
|
||||
<div class="tw-flex tw-gap-2 tw-text-sm">
|
||||
<v-img
|
||||
src="@/assets/gcal_logo.png"
|
||||
@@ -55,11 +55,11 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tw-text-md tw-font-medium tw-mb-4">
|
||||
<div class="tw-text-md tw-mb-4 tw-font-medium">
|
||||
These permissions will
|
||||
</div>
|
||||
<div
|
||||
class="tw-flex tw-flex-col tw-gap-4 tw-mb-8 tw-text-very-dark-gray tw-text-sm"
|
||||
class="tw-mb-8 tw-flex tw-flex-col tw-gap-4 tw-text-sm tw-text-very-dark-gray"
|
||||
>
|
||||
<div>
|
||||
Allow us to display the names/times of your calendar events
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
<div class="tw-flex">
|
||||
<!-- <v-spacer /> -->
|
||||
<v-btn @click="showChoices" text class="tw-flex-1 tw-mr-2">
|
||||
<v-btn @click="showChoices" text class="tw-mr-2 tw-flex-1">
|
||||
Back
|
||||
</v-btn>
|
||||
<v-btn
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<v-card
|
||||
class="tw-py-4 tw-flex tw-flex-col tw-rounded-lg tw-relative tw-overflow-none tw-max-w-[28rem]"
|
||||
class="tw-overflow-none tw-relative tw-flex tw-max-w-[28rem] tw-flex-col tw-rounded-lg tw-py-4"
|
||||
>
|
||||
<v-card-title class="tw-px-4 sm:tw-px-8 tw-flex tw-mb-2">
|
||||
<v-card-title class="tw-mb-2 tw-flex tw-px-4 sm:tw-px-8">
|
||||
<div>
|
||||
{{ editEvent ? "Edit event" : "New event" }}
|
||||
</div>
|
||||
@@ -11,8 +11,8 @@
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
</v-card-title>
|
||||
<v-card-text class="tw-px-4 sm:tw-px-8 tw-overflow-auto tw-py-1 tw-flex-1">
|
||||
<div class="tw-space-y-10 tw-flex tw-flex-col">
|
||||
<v-card-text class="tw-flex-1 tw-overflow-auto tw-px-4 tw-py-1 sm:tw-px-8">
|
||||
<div class="tw-flex tw-flex-col tw-space-y-10">
|
||||
<v-text-field
|
||||
ref="name-field"
|
||||
v-model="name"
|
||||
@@ -25,14 +25,14 @@
|
||||
/>
|
||||
|
||||
<div>
|
||||
<div class="tw-text-lg tw-text-black tw-mb-4">
|
||||
<div class="tw-mb-4 tw-text-lg tw-text-black">
|
||||
What times might work?
|
||||
</div>
|
||||
<div class="tw-flex tw-space-x-2 tw-items-baseline tw-justify-center">
|
||||
<div class="tw-flex tw-items-baseline tw-justify-center tw-space-x-2">
|
||||
<v-select
|
||||
v-model="startTime"
|
||||
:disabled="loading"
|
||||
class="tw-flex-initial /*tw-w-28*/"
|
||||
class="/*tw-w-28*/ tw-flex-initial"
|
||||
menu-props="auto"
|
||||
:items="times"
|
||||
hide-details
|
||||
@@ -42,7 +42,7 @@
|
||||
<v-select
|
||||
v-model="endTime"
|
||||
:disabled="loading"
|
||||
class="tw-flex-initial /*tw-w-28*/"
|
||||
class="/*tw-w-28*/ tw-flex-initial"
|
||||
menu-props="auto"
|
||||
:items="times"
|
||||
hide-details
|
||||
@@ -52,18 +52,18 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="tw-text-lg tw-text-black tw-mb-4">
|
||||
<div class="tw-mb-4 tw-text-lg tw-text-black">
|
||||
What
|
||||
{{ selectedDateOption === dateOptions.SPECIFIC ? "dates" : "days" }}
|
||||
might work?
|
||||
</div>
|
||||
<!-- <v-select
|
||||
<v-select
|
||||
v-model="selectedDateOption"
|
||||
:items="Object.values(dateOptions)"
|
||||
solo
|
||||
hide-details
|
||||
class="tw-mb-4"
|
||||
/> -->
|
||||
/>
|
||||
|
||||
<v-expand-transition>
|
||||
<v-date-picker
|
||||
@@ -73,7 +73,7 @@
|
||||
multiple
|
||||
color="primary"
|
||||
:show-current="false"
|
||||
class="tw-min-w-full sm:tw-min-w-0 tw-border-0 tw-drop-shadow"
|
||||
class="tw-min-w-full tw-border-0 tw-drop-shadow sm:tw-min-w-0"
|
||||
:min="minCalendarDate"
|
||||
full-width
|
||||
/>
|
||||
@@ -104,7 +104,7 @@
|
||||
/>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-actions class="tw-px-8 tw-relative">
|
||||
<v-card-actions class="tw-relative tw-px-8">
|
||||
<v-btn
|
||||
block
|
||||
:loading="loading"
|
||||
@@ -120,6 +120,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { eventTypes, dayIndexToDayString } from "@/constants"
|
||||
import {
|
||||
post,
|
||||
put,
|
||||
@@ -157,27 +158,11 @@ export default {
|
||||
selectedDateOption: "Specific dates",
|
||||
}),
|
||||
|
||||
created() {
|
||||
// Populate event fields if this.event exists
|
||||
if (this.event) {
|
||||
this.name = this.event.name
|
||||
this.startTime = Math.floor(dateToTimeNum(this.event.dates[0]))
|
||||
this.endTime = (this.startTime + this.event.duration) % 24
|
||||
this.notificationsEnabled = this.event.notificationsEnabled
|
||||
|
||||
const selectedDays = []
|
||||
for (const date of this.event.dates) {
|
||||
selectedDays.push(getISODateString(date))
|
||||
}
|
||||
this.selectedDays = selectedDays
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
formComplete() {
|
||||
return (
|
||||
this.name.length > 0 &&
|
||||
this.selectedDays.length > 0 &&
|
||||
(this.selectedDays.length > 0 || this.selectedDaysOfWeek.length > 0) &&
|
||||
(this.startTime < this.endTime ||
|
||||
(this.endTime === 0 && this.startTime != 0))
|
||||
)
|
||||
@@ -229,12 +214,27 @@ export default {
|
||||
let duration = this.endTime - this.startTime
|
||||
if (duration < 0) duration += 24
|
||||
|
||||
let dates = []
|
||||
let type = ""
|
||||
|
||||
// Get date objects for each selected day
|
||||
const startTimeString = timeNumToTimeString(this.startTime)
|
||||
const dates = []
|
||||
for (const day of this.selectedDays) {
|
||||
const date = new Date(`${day}T${startTimeString}`)
|
||||
dates.push(date)
|
||||
if (this.selectedDateOption === this.dateOptions.SPECIFIC) {
|
||||
type = eventTypes.SPECIFIC_DATES
|
||||
|
||||
for (const day of this.selectedDays) {
|
||||
const date = new Date(`${day}T${startTimeString}`)
|
||||
dates.push(date)
|
||||
}
|
||||
} else if (this.selectedDateOption === this.dateOptions.DOW) {
|
||||
type = eventTypes.DOW
|
||||
|
||||
this.selectedDaysOfWeek.sort((a, b) => a - b)
|
||||
for (const dayIndex of this.selectedDaysOfWeek) {
|
||||
const day = dayIndexToDayString[dayIndex]
|
||||
const date = new Date(`${day}T${startTimeString}`)
|
||||
dates.push(date)
|
||||
}
|
||||
}
|
||||
|
||||
this.loading = true
|
||||
@@ -245,6 +245,7 @@ export default {
|
||||
duration,
|
||||
dates,
|
||||
notificationsEnabled: this.notificationsEnabled,
|
||||
type,
|
||||
}).then(({ eventId }) => {
|
||||
this.$router.push({ name: "event", params: { eventId } })
|
||||
this.loading = false
|
||||
@@ -257,6 +258,7 @@ export default {
|
||||
duration,
|
||||
dates,
|
||||
notificationsEnabled: this.notificationsEnabled,
|
||||
type,
|
||||
}).then(() => {
|
||||
window.location.reload()
|
||||
})
|
||||
@@ -264,5 +266,44 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
event: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
// Populate event fields if this.event exists
|
||||
if (this.event) {
|
||||
this.name = this.event.name
|
||||
this.startTime = Math.floor(dateToTimeNum(this.event.dates[0]))
|
||||
this.endTime = (this.startTime + this.event.duration) % 24
|
||||
this.notificationsEnabled = this.event.notificationsEnabled
|
||||
|
||||
if (this.event.type === eventTypes.SPECIFIC_DATES) {
|
||||
this.selectedDateOption = this.dateOptions.SPECIFIC
|
||||
const selectedDays = []
|
||||
for (const date of this.event.dates) {
|
||||
selectedDays.push(getISODateString(date))
|
||||
}
|
||||
this.selectedDays = selectedDays
|
||||
} else if (this.event.type === eventTypes.DOW) {
|
||||
this.selectedDateOption = this.dateOptions.DOW
|
||||
const selectedDaysOfWeek = []
|
||||
for (const date of this.event.dates) {
|
||||
selectedDaysOfWeek.push(new Date(date).getDay())
|
||||
}
|
||||
this.selectedDaysOfWeek = selectedDaysOfWeek
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
selectedDateOption() {
|
||||
// Reset the other date / day selection when date option is changed
|
||||
if (this.selectedDateOption === this.dateOptions.SPECIFIC) {
|
||||
this.selectedDaysOfWeek = []
|
||||
} else if (this.selectedDateOption === this.dateOptions.DOW) {
|
||||
this.selectedDays = []
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- Displays a number within a green circle -->
|
||||
<template>
|
||||
<div
|
||||
class="tw-grid tw-place-content-center tw-rounded-full tw-shrink-0 tw-bg-dark-green tw-text-white tw-w-7 tw-h-7 tw-text-sm tw-font-medium"
|
||||
class="tw-grid tw-h-7 tw-w-7 tw-shrink-0 tw-place-content-center tw-rounded-full tw-bg-dark-green tw-text-sm tw-font-medium tw-text-white"
|
||||
>
|
||||
<slot></slot>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<v-btn
|
||||
:class="dark ? 'tw-bg-blue' : 'tw-bg-white'"
|
||||
class="tw-p-0 tw-mb-2 tw-h-10"
|
||||
@click="e => $emit('click', e)"
|
||||
class="tw-mb-2 tw-h-10 tw-p-0"
|
||||
@click="(e) => $emit('click', e)"
|
||||
>
|
||||
<div class="tw-flex tw-items-center">
|
||||
<div
|
||||
class="tw-ml-0.5 tw-bg-white tw-h-9 tw-w-9 tw-rounded tw-grid tw-place-content-center"
|
||||
class="tw-ml-0.5 tw-grid tw-h-9 tw-w-9 tw-place-content-center tw-rounded tw-bg-white"
|
||||
>
|
||||
<v-img
|
||||
contain
|
||||
@@ -15,23 +15,22 @@
|
||||
src="@/assets/google_logo.svg"
|
||||
></v-img>
|
||||
</div>
|
||||
<div
|
||||
class="tw-mx-3"
|
||||
:class="dark ? 'tw-text-white' : 'tw-text-black'"
|
||||
>{{ text }}</div>
|
||||
<div class="tw-mx-3" :class="dark ? 'tw-text-white' : 'tw-text-black'">
|
||||
{{ text }}
|
||||
</div>
|
||||
</div>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SignInGoogleBtn',
|
||||
name: "SignInGoogleBtn",
|
||||
|
||||
emits: ['click'],
|
||||
emits: ["click"],
|
||||
|
||||
props: {
|
||||
text: { type: String, default: 'Continue with Google' },
|
||||
text: { type: String, default: "Continue with Google" },
|
||||
dark: { type: Boolean, default: false },
|
||||
},
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
@@ -30,5 +30,5 @@ export default {
|
||||
props: {
|
||||
value: { type: Boolean, required: true },
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'UserAvatarContent',
|
||||
name: "UserAvatarContent",
|
||||
props: {
|
||||
user: Object,
|
||||
size: { type: Number, default: 48 },
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<v-container
|
||||
@click="$emit('click')"
|
||||
class="tw-bg-light-gray tw-rounded-md tw-flex tw-text-black tw-justify-between tw-align-middle tw-py-2"
|
||||
class="tw-flex tw-justify-between tw-rounded-md tw-bg-light-gray tw-py-2 tw-align-middle tw-text-black"
|
||||
>
|
||||
<div class="tw-flex tw-mt-2">
|
||||
<div class="tw-mt-2 tw-flex">
|
||||
<div class="tw-mr-3">
|
||||
<v-avatar>
|
||||
<img
|
||||
@@ -19,56 +19,49 @@
|
||||
Currently
|
||||
<span
|
||||
v-if="this.user.status == 'free'"
|
||||
class="tw-text-green tw-font-bold"
|
||||
class="tw-font-bold tw-text-green"
|
||||
>free</span
|
||||
><span v-else>
|
||||
in
|
||||
<span class="tw-text-light-blue tw-font-bold">
|
||||
<span class="tw-font-bold tw-text-light-blue">
|
||||
{{ this.user.status }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div >
|
||||
<v-switch
|
||||
v-model="showEventNames"
|
||||
inset
|
||||
></v-switch>
|
||||
<div>
|
||||
<v-switch v-model="showEventNames" inset></v-switch>
|
||||
</div>
|
||||
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'UserItem',
|
||||
name: "UserItem",
|
||||
|
||||
props: {
|
||||
user: { type: Object, required: true },
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (localStorage.showEventNames) {
|
||||
this.showEventNames = localStorage.showEventNames
|
||||
}
|
||||
if (localStorage.showEventNames) {
|
||||
this.showEventNames = localStorage.showEventNames
|
||||
}
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
showEventNames: true,
|
||||
showEventNames: true,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
|
||||
},
|
||||
computed: {},
|
||||
|
||||
watch: {
|
||||
showEventNames(val) {
|
||||
localStorage.showEventNames = val
|
||||
this.$emit("showEventNames", val)
|
||||
}
|
||||
showEventNames(val) {
|
||||
localStorage.showEventNames = val
|
||||
this.$emit("showEventNames", val)
|
||||
},
|
||||
},
|
||||
|
||||
methods: {},
|
||||
|
||||
@@ -29,17 +29,17 @@
|
||||
to receive email auto-suggestions.
|
||||
</span>
|
||||
</div>
|
||||
<div class="tw-max-h-96 tw-overflow-y-auto tw-table-auto">
|
||||
<table class="tw-text-black tw-w-full tw-text-left">
|
||||
<div class="tw-max-h-96 tw-table-auto tw-overflow-y-auto">
|
||||
<table class="tw-w-full tw-text-left tw-text-black">
|
||||
<thead>
|
||||
<tr class="tw-font-medium tw-bg-white">
|
||||
<tr class="tw-bg-white tw-font-medium">
|
||||
<th
|
||||
class="tw-pb-4 tw-bg-white tw-sticky tw-top-0 tw-z-10"
|
||||
class="tw-sticky tw-top-0 tw-z-10 tw-bg-white tw-pb-4"
|
||||
>
|
||||
Name
|
||||
</th>
|
||||
<th
|
||||
class="tw-pb-4 tw-bg-white tw-sticky tw-top-0 tw-z-10"
|
||||
class="tw-sticky tw-top-0 tw-z-10 tw-bg-white tw-pb-4"
|
||||
>
|
||||
Email
|
||||
</th>
|
||||
@@ -52,7 +52,7 @@
|
||||
<UserAvatarContent
|
||||
v-if="respondent.email.length > 0"
|
||||
:user="respondent"
|
||||
class="tw-w-4 tw-h-4 -tw-ml-3 -tw-mr-1"
|
||||
class="-tw-ml-3 -tw-mr-1 tw-h-4 tw-w-4"
|
||||
></UserAvatarContent>
|
||||
<v-icon v-else class="tw-ml-1 tw-mr-3" small>
|
||||
mdi-account
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="calendarPermissionGranted"
|
||||
class="sm:tw-w-initial tw-fixed tw-left-0 tw-bottom-16 tw-flex tw-h-16 tw-w-full tw-items-center tw-justify-between tw-bg-white tw-px-2 tw-drop-shadow sm:tw-relative sm:tw-bottom-0 sm:tw-h-[unset] sm:tw-flex-1 sm:tw-px-0 sm:tw-drop-shadow-none"
|
||||
>
|
||||
<v-btn @click="prevWeek" icon><v-icon>mdi-chevron-left</v-icon></v-btn>
|
||||
<div class="tw-text-center sm:tw-w-72">
|
||||
Showing Google Calendar for week of {{ weekText }}
|
||||
</div>
|
||||
<v-btn @click="nextWeek" icon><v-icon>mdi-chevron-right</v-icon></v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isPhone } from "@/utils"
|
||||
import dayjs from "dayjs"
|
||||
|
||||
export default {
|
||||
name: "GCalWeekSelector",
|
||||
|
||||
props: {
|
||||
calendarPermissionGranted: { type: Boolean, required: true },
|
||||
weekOffset: { type: Number, required: true },
|
||||
},
|
||||
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
|
||||
computed: {
|
||||
isPhone() {
|
||||
return isPhone(this.$vuetify)
|
||||
},
|
||||
weekText() {
|
||||
const date = new Date()
|
||||
// Set date to the Sunday of the current week
|
||||
date.setDate(date.getDate() - date.getDay())
|
||||
// Change date by the weekoffset
|
||||
date.setDate(date.getDate() + 7 * this.weekOffset)
|
||||
|
||||
return dayjs(date).format("M/D")
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
nextWeek() {
|
||||
this.$emit("update:weekOffset", this.weekOffset + 1)
|
||||
},
|
||||
prevWeek() {
|
||||
this.$emit("update:weekOffset", this.weekOffset - 1)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<span>
|
||||
<div class="tw-p-4 tw-select-none" style="-webkit-touch-callout: none">
|
||||
<div class="tw-select-none tw-p-4" style="-webkit-touch-callout: none">
|
||||
<div class="tw-flex tw-flex-wrap sm:tw-flex-nowrap">
|
||||
<div class="tw-grow tw-flex tw-overflow-hidden">
|
||||
<div class="tw-flex tw-grow tw-overflow-hidden">
|
||||
<!-- Times -->
|
||||
<div class="tw-w-12 tw-mt-12 tw-flex-none">
|
||||
<div class="tw-mt-12 tw-w-12 tw-flex-none">
|
||||
<div class="-tw-mt-[8px]">
|
||||
<div
|
||||
v-for="(time, i) in times"
|
||||
:key="i"
|
||||
class="tw-h-5 tw-text-xs tw-pr-2 tw-text-right tw-uppercase tw-font-light"
|
||||
class="tw-h-5 tw-pr-2 tw-text-right tw-text-xs tw-font-light tw-uppercase"
|
||||
>
|
||||
{{ time.text }}
|
||||
</div>
|
||||
@@ -17,14 +17,16 @@
|
||||
</div>
|
||||
|
||||
<div class="tw-grow tw-overflow-hidden">
|
||||
<div class="tw-overflow-hidden tw-relative">
|
||||
<div class="tw-relative tw-overflow-hidden">
|
||||
<div
|
||||
ref="calendar"
|
||||
@scroll="onCalendarScroll"
|
||||
class="tw-flex tw-flex-col tw-overflow-x-auto tw-overflow-y-hidden tw-relative"
|
||||
class="tw-relative tw-flex tw-flex-col tw-overflow-x-auto tw-overflow-y-hidden"
|
||||
>
|
||||
<!-- Days -->
|
||||
<div class="tw-flex tw-h-12 tw-bg-white tw-z-10">
|
||||
<div
|
||||
class="tw-z-10 tw-flex tw-h-12 tw-items-center tw-bg-white"
|
||||
>
|
||||
<div
|
||||
v-for="(day, i) in days"
|
||||
:key="i"
|
||||
@@ -33,7 +35,8 @@
|
||||
>
|
||||
<div class="tw-text-center">
|
||||
<div
|
||||
class="tw-capitalize tw-font-light tw-text-xs tw-text-very-dark-gray"
|
||||
v-if="isSpecificDates"
|
||||
class="tw-text-xs tw-font-light tw-capitalize tw-text-very-dark-gray"
|
||||
>
|
||||
{{ day.dateString }}
|
||||
</div>
|
||||
@@ -50,7 +53,7 @@
|
||||
<div
|
||||
id="times"
|
||||
data-long-press-delay="500"
|
||||
class="tw-flex tw-relative"
|
||||
class="tw-relative tw-flex"
|
||||
@mouseleave="resetCurTimeslot"
|
||||
>
|
||||
<!-- Loader -->
|
||||
@@ -59,7 +62,7 @@
|
||||
(alwaysShowCalendarEvents || editing) &&
|
||||
loadingCalendarEvents
|
||||
"
|
||||
class="tw-absolute tw-grid tw-place-content-center tw-w-full tw-h-full tw-z-10"
|
||||
class="tw-absolute tw-z-10 tw-grid tw-h-full tw-w-full tw-place-content-center"
|
||||
>
|
||||
<v-progress-circular
|
||||
class="tw-text-blue"
|
||||
@@ -70,7 +73,7 @@
|
||||
<div
|
||||
v-for="(day, d) in days"
|
||||
:key="d"
|
||||
class="tw-flex-1 tw-relative"
|
||||
class="tw-relative tw-flex-1"
|
||||
style="min-width: 50px"
|
||||
>
|
||||
<!-- Timeslots -->
|
||||
@@ -80,7 +83,7 @@
|
||||
class="tw-w-full"
|
||||
>
|
||||
<div
|
||||
class="timeslot tw-h-5 tw-border-[#DDDDDD88] tw-border-r"
|
||||
class="timeslot tw-h-5 tw-border-r tw-border-[#DDDDDD88]"
|
||||
:class="timeslotClassStyle(day, time, d, t).class"
|
||||
:style="timeslotClassStyle(day, time, d, t).style"
|
||||
v-on="timeslotVon(d, t)"
|
||||
@@ -95,7 +98,7 @@
|
||||
appear
|
||||
>
|
||||
<div
|
||||
class="tw-absolute tw-w-full tw-p-px tw-select-none"
|
||||
class="tw-absolute tw-w-full tw-select-none tw-p-px"
|
||||
:style="{
|
||||
top: `calc(${event.hoursOffset} * 2 * 1.25rem)`,
|
||||
height: `calc(${event.hoursLength} * 2 * 1.25rem)`,
|
||||
@@ -103,7 +106,7 @@
|
||||
style="pointer-events: none"
|
||||
>
|
||||
<div
|
||||
class="tw-border-blue tw-border-solid tw-border tw-w-full tw-h-full tw-text-ellipsis tw-text-xs tw-rounded tw-p-px tw-overflow-hidden"
|
||||
class="tw-h-full tw-w-full tw-overflow-hidden tw-text-ellipsis tw-rounded tw-border tw-border-solid tw-border-blue tw-p-px tw-text-xs"
|
||||
>
|
||||
<div
|
||||
:class="`tw-text-${
|
||||
@@ -127,15 +130,15 @@
|
||||
curScheduledEvent &&
|
||||
curScheduledEvent.dayIndex === d)
|
||||
"
|
||||
class="tw-absolute tw-w-full tw-p-px tw-select-none"
|
||||
class="tw-absolute tw-w-full tw-select-none tw-p-px"
|
||||
:style="scheduledEventStyle"
|
||||
style="pointer-events: none"
|
||||
>
|
||||
<div
|
||||
class="tw-border-blue tw-bg-blue tw-border-solid tw-border tw-w-full tw-h-full tw-text-ellipsis tw-text-xs tw-rounded tw-p-px tw-overflow-hidden"
|
||||
class="tw-h-full tw-w-full tw-overflow-hidden tw-text-ellipsis tw-rounded tw-border tw-border-solid tw-border-blue tw-bg-blue tw-p-px tw-text-xs"
|
||||
>
|
||||
<div class="tw-text-white tw-font-medium">
|
||||
{{ name }}
|
||||
<div class="tw-font-medium tw-text-white">
|
||||
{{ event.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -149,19 +152,19 @@
|
||||
<ZigZag
|
||||
v-if="showLeftZigZag"
|
||||
left
|
||||
class="tw-w-3 tw-h-full tw-absolute tw-left-0 tw-top-0"
|
||||
class="tw-absolute tw-left-0 tw-top-0 tw-h-full tw-w-3"
|
||||
/>
|
||||
<ZigZag
|
||||
v-if="showRightZigZag"
|
||||
right
|
||||
class="tw-w-3 tw-h-full tw-absolute tw-right-0 tw-top-0"
|
||||
class="tw-absolute tw-right-0 tw-top-0 tw-h-full tw-w-3"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Hint text (desktop) -->
|
||||
<div v-if="!isPhone && showHintText" class="tw-flex">
|
||||
<div
|
||||
class="tw-text-dark-gray tw-text-sm tw-mt-2"
|
||||
class="tw-mt-2 tw-text-sm tw-text-dark-gray"
|
||||
style="min-height: 1.4rem"
|
||||
>
|
||||
{{ hintText.desktop }}
|
||||
@@ -177,6 +180,10 @@
|
||||
:show-best-times.sync="showBestTimes"
|
||||
:is-owner="isOwner"
|
||||
:cur-scheduled-event="curScheduledEvent"
|
||||
:is-weekly="isWeekly"
|
||||
:calendar-permission-granted="calendarPermissionGranted"
|
||||
:week-offset="weekOffset"
|
||||
@update:weekOffset="(val) => $emit('update:weekOffset', val)"
|
||||
@onShowBestTimesChange="onShowBestTimesChange"
|
||||
@scheduleEvent="scheduleEvent"
|
||||
@cancelScheduleEvent="cancelScheduleEvent"
|
||||
@@ -191,7 +198,7 @@
|
||||
<div v-if="isPhone && showHintText" class="tw-flex">
|
||||
<div class="tw-w-12"></div>
|
||||
<div
|
||||
class="tw-text-dark-gray tw-text-xs tw-mt-2"
|
||||
class="tw-mt-2 tw-text-xs tw-text-dark-gray"
|
||||
style="min-height: 2rem"
|
||||
>
|
||||
{{ hintText.mobile }}
|
||||
@@ -201,9 +208,9 @@
|
||||
<!-- Respondents -->
|
||||
<div
|
||||
v-if="!calendarOnly"
|
||||
class="tw-py-4 tw-w-full sm:tw-pl-8 sm:tw-flex-none sm:tw-py-0 sm:tw-pr-0 sm:tw-pt-12 sm:tw-w-48"
|
||||
class="tw-w-full tw-py-4 sm:tw-w-48 sm:tw-flex-none sm:tw-py-0 sm:tw-pl-8 sm:tw-pr-0 sm:tw-pt-12"
|
||||
>
|
||||
<div class="tw-font-medium tw-mb-2 tw-flex tw-items-center">
|
||||
<div class="tw-mb-2 tw-flex tw-items-center tw-font-medium">
|
||||
<div class="tw-mr-1 tw-text-lg">Responses</div>
|
||||
<div class="tw-font-normal">
|
||||
<template v-if="curRespondents.length === 0">
|
||||
@@ -222,31 +229,38 @@
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="/*tw-pl-4*/ tw-text-sm tw-grid tw-grid-cols-2 tw-gap-x-2 sm:tw-block"
|
||||
>
|
||||
<div
|
||||
v-for="(user, i) in respondents"
|
||||
:key="user._id"
|
||||
class="tw-py-1 tw-flex tw-items-center tw-cursor-pointer"
|
||||
@mouseover="(e) => mouseOverRespondent(e, user._id)"
|
||||
@mouseleave="mouseLeaveRespondent"
|
||||
@click="(e) => clickRespondent(e, user._id)"
|
||||
>
|
||||
<UserAvatarContent
|
||||
v-if="!isGuest(user)"
|
||||
:user="user"
|
||||
class="tw-w-4 tw-h-4 -tw-ml-3 -tw-mr-1"
|
||||
></UserAvatarContent>
|
||||
<v-icon v-else class="tw-ml-1 tw-mr-3" small>mdi-account</v-icon>
|
||||
|
||||
<div
|
||||
class="tw-mr-1 tw-transition-all"
|
||||
:class="respondentClass(user._id)"
|
||||
>
|
||||
{{ user.firstName + " " + user.lastName }}
|
||||
<div class="tw-grid tw-grid-cols-2 tw-gap-x-2 tw-text-sm sm:tw-block">
|
||||
<template v-if="respondents.length === 0">
|
||||
<div class="tw-px-2 tw-text-very-dark-gray">
|
||||
No responses yet!
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div
|
||||
v-for="(user, i) in respondents"
|
||||
:key="user._id"
|
||||
class="tw-flex tw-cursor-pointer tw-items-center tw-py-1"
|
||||
@mouseover="(e) => mouseOverRespondent(e, user._id)"
|
||||
@mouseleave="mouseLeaveRespondent"
|
||||
@click="(e) => clickRespondent(e, user._id)"
|
||||
>
|
||||
<UserAvatarContent
|
||||
v-if="!isGuest(user)"
|
||||
:user="user"
|
||||
class="-tw-ml-3 -tw-mr-1 tw-h-4 tw-w-4"
|
||||
></UserAvatarContent>
|
||||
<v-icon v-else class="tw-ml-1 tw-mr-3" small
|
||||
>mdi-account</v-icon
|
||||
>
|
||||
|
||||
<div
|
||||
class="tw-mr-1 tw-transition-all"
|
||||
:class="respondentClass(user._id)"
|
||||
>
|
||||
{{ user.firstName + " " + user.lastName }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -260,6 +274,10 @@
|
||||
:show-best-times.sync="showBestTimes"
|
||||
:is-owner="isOwner"
|
||||
:cur-scheduled-event="curScheduledEvent"
|
||||
:is-weekly="isWeekly"
|
||||
:calendar-permission-granted="calendarPermissionGranted"
|
||||
:week-offset="weekOffset"
|
||||
@update:weekOffset="(val) => $emit('update:weekOffset', val)"
|
||||
@onShowBestTimesChange="onShowBestTimesChange"
|
||||
@scheduleEvent="scheduleEvent"
|
||||
@cancelScheduleEvent="cancelScheduleEvent"
|
||||
@@ -298,6 +316,7 @@ import {
|
||||
isPhone,
|
||||
utcTimeToLocalTime,
|
||||
} from "@/utils"
|
||||
import { eventTypes } from "@/constants"
|
||||
import { mapActions, mapState } from "vuex"
|
||||
import UserAvatarContent from "@/components/UserAvatarContent.vue"
|
||||
import ZigZag from "./ZigZag.vue"
|
||||
@@ -309,17 +328,14 @@ import ToolRow from "./ToolRow.vue"
|
||||
export default {
|
||||
name: "ScheduleOverlap",
|
||||
props: {
|
||||
eventId: { type: String, default: "" }, // ID of event
|
||||
ownerId: { type: String, default: "" }, // ID of the owner of the event
|
||||
name: { type: String, default: "" }, // Name of event
|
||||
startTime: { type: Number, required: true }, // Start time of event
|
||||
endTime: { type: Number, required: true }, // End time of event
|
||||
duration: { type: Number, required: true }, // Duration of event
|
||||
dates: { type: Array, required: true }, // Dates of the event
|
||||
responses: { type: Object, default: () => ({}) }, // Map of user id to array of times they are available
|
||||
event: { type: Object, required: true },
|
||||
|
||||
loadingCalendarEvents: { type: Boolean, default: false }, // Whether we are currently loading the calendar events
|
||||
calendarEventsByDay: { type: Array, default: () => [] }, // Array of arrays of calendar events
|
||||
calendarPermissionGranted: { type: Boolean, default: false }, // Whether user has granted google calendar permissions
|
||||
|
||||
weekOffset: { type: Number, default: 0 }, // Week offset used for displaying calendar events on weekly schejs
|
||||
|
||||
alwaysShowCalendarEvents: { type: Boolean, default: false }, // Whether to show calendar events all the time
|
||||
noEventNames: { type: Boolean, default: false }, // Whether to show "busy" instead of the event name
|
||||
calendarOnly: { type: Boolean, default: false }, // Whether to only show calendar and not respondents or any other controls
|
||||
@@ -426,8 +442,7 @@ export default {
|
||||
"dec",
|
||||
]
|
||||
|
||||
// New date representation method
|
||||
for (let date of this.dates) {
|
||||
for (let date of this.event.dates) {
|
||||
date = new Date(date)
|
||||
|
||||
days.push({
|
||||
@@ -436,6 +451,7 @@ export default {
|
||||
dateObject: date,
|
||||
})
|
||||
}
|
||||
|
||||
return days
|
||||
},
|
||||
defaultState() {
|
||||
@@ -470,7 +486,13 @@ export default {
|
||||
return isPhone(this.$vuetify)
|
||||
},
|
||||
isOwner() {
|
||||
return this.authUser?._id === this.ownerId
|
||||
return this.authUser?._id === this.event.ownerId
|
||||
},
|
||||
isSpecificDates() {
|
||||
return this.event.type === eventTypes.SPECIFIC_DATES || !this.event.type
|
||||
},
|
||||
isWeekly() {
|
||||
return this.event.type === eventTypes.DOW
|
||||
},
|
||||
respondents() {
|
||||
return Object.values(this.parsedResponses).map((r) => r.user)
|
||||
@@ -498,13 +520,13 @@ export default {
|
||||
parsedResponses() {
|
||||
/* Parses responses so that if _id is null (i.e. guest user), then it is set to the guest user's name */
|
||||
const parsed = {}
|
||||
for (const k of Object.keys(this.responses)) {
|
||||
for (const k of Object.keys(this.event.responses)) {
|
||||
const newUser = {
|
||||
...this.responses[k].user,
|
||||
...this.event.responses[k].user,
|
||||
_id: k,
|
||||
}
|
||||
parsed[k] = {
|
||||
...this.responses[k],
|
||||
...this.event.responses[k],
|
||||
user: newUser,
|
||||
}
|
||||
}
|
||||
@@ -538,8 +560,8 @@ export default {
|
||||
/* Returns the times that are encompassed by startTime and endTime */
|
||||
const times = []
|
||||
|
||||
for (let i = 0; i < this.duration; ++i) {
|
||||
const utcTimeNum = this.startTime + i
|
||||
for (let i = 0; i < this.event.duration; ++i) {
|
||||
const utcTimeNum = this.event.startTime + i
|
||||
const localTimeNum = utcTimeToLocalTime(utcTimeNum, this.timezoneOffset)
|
||||
|
||||
times.push({
|
||||
@@ -751,7 +773,7 @@ export default {
|
||||
},
|
||||
populateUserAvailability(id) {
|
||||
/* Populates the availability set for the auth user from the responses object stored on the server */
|
||||
this.responses[id].availability.forEach((item) =>
|
||||
this.event.responses[id].availability.forEach((item) =>
|
||||
this.availability.add(new Date(item).getTime())
|
||||
)
|
||||
this.$nextTick(() => (this.unsavedChanges = false))
|
||||
@@ -759,6 +781,7 @@ export default {
|
||||
setAvailabilityAutomatically() {
|
||||
/* Constructs the availability array using calendarEvents array */
|
||||
// This is not a computed property because we should be able to change it manually from what it automatically fills in
|
||||
this.availability = new Set()
|
||||
const tmpAvailability = new Set()
|
||||
for (const d in this.days) {
|
||||
const day = this.days[d]
|
||||
@@ -834,7 +857,7 @@ export default {
|
||||
payload.guest = true
|
||||
payload.name = name
|
||||
}
|
||||
await post(`/events/${this.eventId}/response`, payload)
|
||||
await post(`/events/${this.event._id}/response`, payload)
|
||||
this.$emit("refreshEvent")
|
||||
this.unsavedChanges = false
|
||||
},
|
||||
@@ -1030,7 +1053,7 @@ export default {
|
||||
this.name
|
||||
)}&dates=${start}/${end}&details=${encodeURIComponent(
|
||||
"\n\nThis event was scheduled with schej: https://schej.it/e/"
|
||||
)}${this.eventId}&add=${emailsString}`
|
||||
)}${this.event._id}&add=${emailsString}`
|
||||
|
||||
// Navigate to url and reset state
|
||||
window.open(url, "_blank")
|
||||
@@ -1185,7 +1208,7 @@ export default {
|
||||
//#region Options
|
||||
// -----------------------------------
|
||||
getLocalTimezone() {
|
||||
const split = new Date(this.dates[0])
|
||||
const split = new Date(this.event.dates[0])
|
||||
.toLocaleTimeString("en-us", { timeZoneName: "short" })
|
||||
.split(" ")
|
||||
const localTimezone = split[split.length - 1]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- Allows user to change timezone -->
|
||||
<template>
|
||||
<div
|
||||
class="tw-flex tw-justify-center tw-items-center"
|
||||
class="tw-flex tw-items-center tw-justify-center"
|
||||
id="timezone-select-container"
|
||||
>
|
||||
<div class="tw-mt-px tw-mr-2">Shown in</div>
|
||||
@@ -9,7 +9,7 @@
|
||||
id="timezone-select"
|
||||
:value="value"
|
||||
@input="$emit('input', $event)"
|
||||
class="tw-text-sm -tw-mt-px tw-flex-none tw-min-w-min tw-max-w-xl"
|
||||
class="-tw-mt-px tw-min-w-min tw-max-w-xl tw-flex-none tw-text-sm"
|
||||
:items="timezones"
|
||||
dense
|
||||
color="#219653"
|
||||
@@ -27,5 +27,5 @@ export default {
|
||||
value: { type: String, required: true },
|
||||
timezones: { type: Array, default: () => [] },
|
||||
},
|
||||
};
|
||||
}
|
||||
</script>
|
||||
@@ -1,10 +1,14 @@
|
||||
<template>
|
||||
<div class="tw-flex">
|
||||
<div>
|
||||
<div
|
||||
class="tw-flex-1 tw-flex tw-items-center tw-mt-4 sm:tw-mt-0 tw-text-sm tw-justify-center sm:tw-justify-between"
|
||||
class="tw-flex tw-min-h-[5rem] tw-flex-1 tw-items-center tw-justify-center tw-text-sm sm:tw-mt-0 sm:tw-justify-between"
|
||||
>
|
||||
<div
|
||||
class="tw-flex tw-gap-4 sm:tw-gap-8 tw-flex-row tw-justify-between sm:tw-justify-start tw-flex-1"
|
||||
:class="`tw-justify-${
|
||||
state === states.EDIT_AVAILABILITY ? 'center' : 'between'
|
||||
}
|
||||
`"
|
||||
class="tw-flex tw-flex-1 tw-flex-wrap tw-gap-y-4 tw-gap-x-4 tw-py-4 sm:tw-justify-start sm:tw-gap-x-8"
|
||||
>
|
||||
<!-- Select timezone -->
|
||||
<TimezoneSelector
|
||||
@@ -13,23 +17,40 @@
|
||||
:timezones="Object.keys(timezoneMap)"
|
||||
/>
|
||||
|
||||
<div class="tw-flex tw-justify-center tw-items-center tw-gap-1">
|
||||
<div>Show best times</div>
|
||||
<v-switch
|
||||
id="show-best-times-toggle"
|
||||
class="-tw-mb-1"
|
||||
:input-value="showBestTimes"
|
||||
@change="updateShowBestTimes"
|
||||
color="#219653"
|
||||
/>
|
||||
</div>
|
||||
<template v-if="state !== states.EDIT_AVAILABILITY">
|
||||
<div class="tw-flex tw-items-center tw-justify-center tw-gap-2">
|
||||
<div>Show best times</div>
|
||||
<v-switch
|
||||
id="show-best-times-toggle"
|
||||
class="tw-mt-0 tw-py-2.5"
|
||||
:input-value="showBestTimes"
|
||||
@change="updateShowBestTimes"
|
||||
color="#219653"
|
||||
hide-details
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isWeekly && !isPhone">
|
||||
<v-spacer />
|
||||
<div class="tw-min-w-fit">
|
||||
<GCalWeekSelector
|
||||
:calendar-permission-granted="calendarPermissionGranted"
|
||||
:week-offset="weekOffset"
|
||||
@update:weekOffset="(val) => $emit('update:weekOffset', val)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div v-if="isOwner" style="width: 180.16px" class="tw-hidden sm:tw-block">
|
||||
<div
|
||||
v-if="isOwner && state !== states.EDIT_AVAILABILITY"
|
||||
style="width: 180.16px"
|
||||
class="tw-hidden sm:tw-block"
|
||||
>
|
||||
<template v-if="state !== states.SCHEDULE_EVENT">
|
||||
<v-btn
|
||||
outlined
|
||||
class="tw-text-green tw-w-full"
|
||||
class="tw-w-full tw-text-green"
|
||||
@click="(e) => $emit('scheduleEvent', e)"
|
||||
>
|
||||
<span class="tw-mr-2">Schedule event</span>
|
||||
@@ -44,7 +65,7 @@
|
||||
<template v-else>
|
||||
<v-btn
|
||||
outlined
|
||||
class="tw-text-red tw-mr-1"
|
||||
class="tw-mr-1 tw-text-red"
|
||||
@click="(e) => $emit('cancelScheduleEvent', e)"
|
||||
>
|
||||
Cancel
|
||||
@@ -52,18 +73,30 @@
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="(e) => $emit('confirmScheduleEvent', e)"
|
||||
:disabled="!curScheduledEvent"
|
||||
>
|
||||
Schedule
|
||||
</v-btn>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- GCal week selector when user is using phone view -->
|
||||
<template v-if="isPhone && isWeekly && state === states.EDIT_AVAILABILITY">
|
||||
<div class="tw-h-16 tw-text-sm">
|
||||
<GCalWeekSelector
|
||||
:calendar-permission-granted="calendarPermissionGranted"
|
||||
:week-offset="weekOffset"
|
||||
@update:weekOffset="(val) => $emit('update:weekOffset', val)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TimezoneSelector from "./TimezoneSelector.vue"
|
||||
import GCalWeekSelector from "./GCalWeekSelector.vue"
|
||||
import { isPhone } from "@/utils"
|
||||
|
||||
export default {
|
||||
name: "ToolRow",
|
||||
@@ -75,11 +108,20 @@ export default {
|
||||
timezoneMap: { type: Object, required: true },
|
||||
showBestTimes: { type: Boolean, required: true },
|
||||
isOwner: { type: Boolean, required: true },
|
||||
curScheduledEvent: { type: Object | null, required: true },
|
||||
isWeekly: { type: Boolean, required: true },
|
||||
calendarPermissionGranted: { type: Boolean, required: true },
|
||||
weekOffset: { type: Number, required: true },
|
||||
},
|
||||
|
||||
components: {
|
||||
TimezoneSelector,
|
||||
GCalWeekSelector,
|
||||
},
|
||||
|
||||
computed: {
|
||||
isPhone() {
|
||||
return isPhone(this.$vuetify)
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -17,3 +17,18 @@ export const authTypes = Object.freeze({
|
||||
EVENT_ADD_AVAILABILITY: "event-add-availability",
|
||||
EVENT_SIGN_IN: "event-sign-in",
|
||||
})
|
||||
|
||||
export const eventTypes = Object.freeze({
|
||||
SPECIFIC_DATES: "specific_dates",
|
||||
DOW: "dow",
|
||||
})
|
||||
|
||||
export const dayIndexToDayString = Object.freeze([
|
||||
"2018-06-17", // Sunday
|
||||
"2018-06-18", // Monday
|
||||
"2018-06-19", // Tuesday
|
||||
"2018-06-20", // Wednesday
|
||||
"2018-06-21", // Thursday
|
||||
"2018-06-22", // Friday
|
||||
"2018-06-23", // Saturday
|
||||
])
|
||||
@@ -1,3 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@tailwind utilities;
|
||||
@@ -1,8 +1,8 @@
|
||||
import Vue from 'vue';
|
||||
import Vuetify from 'vuetify/lib';
|
||||
import tailwind from '../../tailwind.config'
|
||||
import Vue from "vue"
|
||||
import Vuetify from "vuetify/lib"
|
||||
import tailwind from "../../tailwind.config"
|
||||
|
||||
Vue.use(Vuetify);
|
||||
Vue.use(Vuetify)
|
||||
|
||||
export default new Vuetify({
|
||||
theme: {
|
||||
@@ -12,4 +12,4 @@ export default new Vuetify({
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
})
|
||||
@@ -1,32 +1,34 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import { register } from 'register-service-worker'
|
||||
import { register } from "register-service-worker"
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
register(`${process.env.BASE_URL}service-worker.js`, {
|
||||
ready () {
|
||||
ready() {
|
||||
console.log(
|
||||
'App is being served from cache by a service worker.\n' +
|
||||
'For more details, visit https://goo.gl/AFskqB'
|
||||
"App is being served from cache by a service worker.\n" +
|
||||
"For more details, visit https://goo.gl/AFskqB"
|
||||
)
|
||||
},
|
||||
registered () {
|
||||
console.log('Service worker has been registered.')
|
||||
registered() {
|
||||
console.log("Service worker has been registered.")
|
||||
},
|
||||
cached () {
|
||||
console.log('Content has been cached for offline use.')
|
||||
cached() {
|
||||
console.log("Content has been cached for offline use.")
|
||||
},
|
||||
updatefound () {
|
||||
console.log('New content is downloading.')
|
||||
updatefound() {
|
||||
console.log("New content is downloading.")
|
||||
},
|
||||
updated () {
|
||||
console.log('New content is available; please refresh.')
|
||||
updated() {
|
||||
console.log("New content is available; please refresh.")
|
||||
},
|
||||
offline () {
|
||||
console.log('No internet connection found. App is running in offline mode.')
|
||||
offline() {
|
||||
console.log(
|
||||
"No internet connection found. App is running in offline mode."
|
||||
)
|
||||
},
|
||||
error(error) {
|
||||
console.error("Error during service worker registration:", error)
|
||||
},
|
||||
error (error) {
|
||||
console.error('Error during service worker registration:', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
+211
-137
@@ -1,68 +1,83 @@
|
||||
import { get } from "./fetch_utils";
|
||||
import { isBetween } from "./general_utils";
|
||||
import { eventTypes } from "@/constants"
|
||||
import { get } from "./fetch_utils"
|
||||
import { isBetween } from "./general_utils"
|
||||
/*
|
||||
Date utils
|
||||
*/
|
||||
|
||||
/** Returns a string representation of the given date, i.e. May 14th is "5/14" */
|
||||
export const getDateString = (date) => {
|
||||
date = new Date(date);
|
||||
return `${date.getMonth() + 1}/${date.getDate()}`;
|
||||
};
|
||||
date = new Date(date)
|
||||
return `${date.getMonth() + 1}/${date.getDate()}`
|
||||
}
|
||||
|
||||
/** Returns an ISO formatted date string */
|
||||
export const getISODateString = (date, utc = false) => {
|
||||
date = new Date(date);
|
||||
date = new Date(date)
|
||||
if (utc) {
|
||||
return date.toISOString().substring(0, 10);
|
||||
return date.toISOString().substring(0, 10)
|
||||
}
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
return `${year}-${month}-${day}`;
|
||||
};
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0")
|
||||
const day = String(date.getDate()).padStart(2, "0")
|
||||
return `${year}-${month}-${day}`
|
||||
}
|
||||
|
||||
/** Returns a string representing date range from date1 to date2, i.e. "5/14 - 5/27" */
|
||||
export const getDateRangeString = (date1, date2) => {
|
||||
date1 = new Date(date1);
|
||||
date2 = new Date(date2);
|
||||
date1 = new Date(date1)
|
||||
date2 = new Date(date2)
|
||||
|
||||
// Correct date2 if time is 12am (because ending at 12am doesn't begin the next day)
|
||||
if (date2.getHours() == 0) {
|
||||
date2 = getDateDayOffset(date2, -1);
|
||||
date2 = getDateDayOffset(date2, -1)
|
||||
}
|
||||
|
||||
return getDateString(date1) + " - " + getDateString(date2);
|
||||
};
|
||||
return getDateString(date1) + " - " + getDateString(date2)
|
||||
}
|
||||
|
||||
/** Returns a string representing the date range for the provided event */
|
||||
export const getDateRangeStringForEvent = (event) => {
|
||||
const startDate = new Date(event.dates[0]);
|
||||
const endDate = new Date(event.dates[event.dates.length - 1]);
|
||||
return getDateRangeString(startDate, endDate);
|
||||
};
|
||||
if (event.type === eventTypes.DOW) {
|
||||
let s = ""
|
||||
|
||||
const dayAbbreviations = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
||||
for (const date of event.dates) {
|
||||
const abbr = dayAbbreviations[new Date(date).getDay()]
|
||||
s += abbr + ", "
|
||||
}
|
||||
s = s.substring(0, s.length - 2)
|
||||
return s
|
||||
} else if (event.type === eventTypes.SPECIFIC_DATES) {
|
||||
const startDate = new Date(event.dates[0])
|
||||
const endDate = new Date(event.dates[event.dates.length - 1])
|
||||
return getDateRangeString(startDate, endDate)
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
/** Returns a new date object with the given date (e.g. 5/2/2022) and the specified time (e.g. "11:30") */
|
||||
export const getDateWithTime = (date, timeString) => {
|
||||
date = new Date(date);
|
||||
date = new Date(date)
|
||||
|
||||
const { hours, minutes } = splitTime(timeString);
|
||||
const { hours, minutes } = splitTime(timeString)
|
||||
return new Date(
|
||||
date.getFullYear(),
|
||||
date.getMonth(),
|
||||
date.getDate(),
|
||||
hours,
|
||||
minutes
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
/** Returns a new date object with the given date (e.g. 5/2/2022) and the specified timeNum (e.g. 11.5) */
|
||||
export const getDateWithTimeNum = (date, timeNum, utc = false) => {
|
||||
date = new Date(date);
|
||||
date = new Date(date)
|
||||
|
||||
const hours = parseInt(timeNum);
|
||||
const minutes = (timeNum - hours) * 60;
|
||||
const hours = parseInt(timeNum)
|
||||
const minutes = (timeNum - hours) * 60
|
||||
if (!utc) {
|
||||
return new Date(
|
||||
date.getFullYear(),
|
||||
@@ -70,7 +85,7 @@ export const getDateWithTimeNum = (date, timeNum, utc = false) => {
|
||||
date.getDate(),
|
||||
hours,
|
||||
minutes
|
||||
);
|
||||
)
|
||||
} else {
|
||||
return new Date(
|
||||
Date.UTC(
|
||||
@@ -80,107 +95,139 @@ export const getDateWithTimeNum = (date, timeNum, utc = false) => {
|
||||
hours,
|
||||
minutes
|
||||
)
|
||||
);
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** Returns a date object from the given mongodb objectId */
|
||||
export const dateFromObjectId = function (objectId) {
|
||||
return new Date(parseInt(objectId.substring(0, 8), 16) * 1000)
|
||||
}
|
||||
|
||||
/** Takes a time string (e.g. 13:30) and splits it into hours and minutes, returning an object of the form { hours, minutes } */
|
||||
export const splitTime = (timeString) => {
|
||||
const [hours, minutes] = timeString.split(":");
|
||||
return { hours: parseInt(hours), minutes: parseInt(minutes) };
|
||||
};
|
||||
const [hours, minutes] = timeString.split(":")
|
||||
return { hours: parseInt(hours), minutes: parseInt(minutes) }
|
||||
}
|
||||
|
||||
/** Takes a timeNum (e.g. 9.5) and splits it into hours and minutes, returning an object of the form { hours, minutes } */
|
||||
export const splitTimeNum = (timeNum) => {
|
||||
const hours = Math.floor(timeNum);
|
||||
const minutes = Math.floor((timeNum - hours) * 60);
|
||||
return { hours, minutes };
|
||||
};
|
||||
const hours = Math.floor(timeNum)
|
||||
const minutes = Math.floor((timeNum - hours) * 60)
|
||||
return { hours, minutes }
|
||||
}
|
||||
|
||||
/** Returns the specified date offset by the given number of days (can be positive or negative) */
|
||||
export const getDateDayOffset = (date, offset) => {
|
||||
date = new Date(date);
|
||||
return new Date(date.getTime() + offset * 24 * 60 * 60 * 1000);
|
||||
};
|
||||
date = new Date(date)
|
||||
return new Date(date.getTime() + offset * 24 * 60 * 60 * 1000)
|
||||
}
|
||||
|
||||
/** Returns the specified date offset by the given number of hours */
|
||||
export const getDateHoursOffset = (date, hoursOffset) => {
|
||||
const { hours, minutes } = splitTimeNum(hoursOffset);
|
||||
const newDate = new Date(date);
|
||||
newDate.setHours(newDate.getHours() + hours);
|
||||
newDate.setMinutes(newDate.getMinutes() + minutes);
|
||||
return newDate;
|
||||
};
|
||||
const { hours, minutes } = splitTimeNum(hoursOffset)
|
||||
const newDate = new Date(date)
|
||||
newDate.setHours(newDate.getHours() + hours)
|
||||
newDate.setMinutes(newDate.getMinutes() + minutes)
|
||||
return newDate
|
||||
}
|
||||
|
||||
/** Returns a date, transformed to be in the same week of the dows array */
|
||||
export const dateToDowDate = (dows, date, weekOffset) => {
|
||||
// Sort dows to make sure first date is not Saturday when there are multiple dates
|
||||
// (as such is the case when an event is created in Tokyo and you're answering in Mountain View)
|
||||
// This fixes the dayOffset calculation so that events are displayed in the correct week
|
||||
dows = [...dows].sort((date1, date2) => {
|
||||
const day1 = new Date(date1).getDay()
|
||||
const day2 = new Date(date2).getDay()
|
||||
return day1 - day2
|
||||
})
|
||||
|
||||
// Get Sunday of the current week offset by weekOffset
|
||||
const curSunday = new Date()
|
||||
curSunday.setDate(curSunday.getDate() - curSunday.getDay())
|
||||
curSunday.setDate(curSunday.getDate() + 7 * weekOffset)
|
||||
|
||||
// Get Sunday of the week containing the dows
|
||||
const dowSunday = new Date(dows[0])
|
||||
dowSunday.setDate(dowSunday.getDate() - dowSunday.getDay())
|
||||
|
||||
// Get the amount of days between both of the sundays
|
||||
const dayOffset = Math.round((curSunday - dowSunday) / (1000 * 60 * 60 * 24))
|
||||
|
||||
// Offset date by the amount of days between the two sundays
|
||||
date = new Date(date)
|
||||
date.setDate(date.getDate() - dayOffset)
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
/** Converts a timeNum (e.g. 13) to a timeText (e.g. "1 pm") */
|
||||
export const timeNumToTimeText = (timeNum) => {
|
||||
const hours = Math.floor(timeNum);
|
||||
const minutesDecimal = timeNum - hours;
|
||||
const hours = Math.floor(timeNum)
|
||||
const minutesDecimal = timeNum - hours
|
||||
const minutesString =
|
||||
minutesDecimal > 0
|
||||
? `:${String(Math.floor(minutesDecimal * 60)).padStart(2, "0")}`
|
||||
: "";
|
||||
: ""
|
||||
|
||||
if (timeNum >= 0 && timeNum < 1) return `12${minutesString} am`;
|
||||
else if (timeNum < 12) return `${hours}${minutesString} am`;
|
||||
else if (timeNum >= 12 && timeNum < 13) return `12${minutesString} pm`;
|
||||
return `${hours - 12}${minutesString} pm`;
|
||||
};
|
||||
if (timeNum >= 0 && timeNum < 1) return `12${minutesString} am`
|
||||
else if (timeNum < 12) return `${hours}${minutesString} am`
|
||||
else if (timeNum >= 12 && timeNum < 13) return `12${minutesString} pm`
|
||||
return `${hours - 12}${minutesString} pm`
|
||||
}
|
||||
|
||||
/** Converts a timeNum (e.g. 9.5) to a timeString (e.g. 09:30:00) */
|
||||
export const timeNumToTimeString = (timeNum) => {
|
||||
const hours = Math.floor(timeNum);
|
||||
const minutesDecimal = timeNum - hours;
|
||||
const paddedHours = String(hours).padStart(2, "0");
|
||||
const paddedMinutes = String(Math.floor(minutesDecimal * 60)).padStart(
|
||||
2,
|
||||
"0"
|
||||
);
|
||||
const hours = Math.floor(timeNum)
|
||||
const minutesDecimal = timeNum - hours
|
||||
const paddedHours = String(hours).padStart(2, "0")
|
||||
const paddedMinutes = String(Math.floor(minutesDecimal * 60)).padStart(2, "0")
|
||||
|
||||
return `${paddedHours}:${paddedMinutes}:00`;
|
||||
};
|
||||
return `${paddedHours}:${paddedMinutes}:00`
|
||||
}
|
||||
|
||||
/** Converts a date to a timeNum (e.g. 9.5) */
|
||||
export const dateToTimeNum = (date, utc = false) => {
|
||||
date = new Date(date);
|
||||
date = new Date(date)
|
||||
if (utc) {
|
||||
return date.getUTCHours() + date.getUTCMinutes() / 60;
|
||||
return date.getUTCHours() + date.getUTCMinutes() / 60
|
||||
}
|
||||
return date.getHours() + date.getMinutes() / 60;
|
||||
};
|
||||
return date.getHours() + date.getMinutes() / 60
|
||||
}
|
||||
|
||||
/** Clamps the date to the given time, type can either be "upper" or "lower" */
|
||||
export const clampDateToTimeNum = (date, timeNum, type) => {
|
||||
const diff = dateToTimeNum(date) - timeNum;
|
||||
const diff = dateToTimeNum(date) - timeNum
|
||||
if (type === "upper" && diff < 0) {
|
||||
return getDateWithTimeNum(date, timeNum);
|
||||
return getDateWithTimeNum(date, timeNum)
|
||||
} else if (type === "lower" && diff > 0) {
|
||||
return getDateWithTimeNum(date, timeNum);
|
||||
return getDateWithTimeNum(date, timeNum)
|
||||
}
|
||||
|
||||
// Return original date
|
||||
return date;
|
||||
};
|
||||
return date
|
||||
}
|
||||
|
||||
/** Returns negative if date1 < date2, positive if date2 > date1, and 0 if date1 == date2 */
|
||||
export const dateCompare = (date1, date2) => {
|
||||
date1 = new Date(date1);
|
||||
date2 = new Date(date2);
|
||||
return date1.getTime() - date2.getTime();
|
||||
};
|
||||
date1 = new Date(date1)
|
||||
date2 = new Date(date2)
|
||||
return date1.getTime() - date2.getTime()
|
||||
}
|
||||
|
||||
/** returns -1 if a is before b, 1 if a is after b, 0 otherwise */
|
||||
export const compareDateDay = (a, b) => {
|
||||
a = new Date(a);
|
||||
b = new Date(b);
|
||||
a = new Date(a)
|
||||
b = new Date(b)
|
||||
if (a.getFullYear() !== b.getFullYear()) {
|
||||
return a.getFullYear() - b.getFullYear();
|
||||
return a.getFullYear() - b.getFullYear()
|
||||
} else if (a.getMonth() !== b.getMonth()) {
|
||||
return a.getMonth() - b.getMonth();
|
||||
return a.getMonth() - b.getMonth()
|
||||
} else {
|
||||
return a.getDate() - b.getDate();
|
||||
return a.getDate() - b.getDate()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
Returns whether the given timeNum is between date1 and date2
|
||||
@@ -188,109 +235,136 @@ such that date1.getHour() <= timeNum <= date2.getHour(), accounting
|
||||
for the possibility that date1 and date2 might be on separate days
|
||||
*/
|
||||
export const isTimeNumBetweenDates = (timeNum, date1, date2) => {
|
||||
const hour1 = date1.getHours();
|
||||
const hour2 = date2.getHours();
|
||||
const hour1 = date1.getHours()
|
||||
const hour2 = date2.getHours()
|
||||
|
||||
if (hour1 <= hour2) {
|
||||
return hour1 <= timeNum && timeNum <= hour2;
|
||||
return hour1 <= timeNum && timeNum <= hour2
|
||||
} else {
|
||||
return (
|
||||
(hour1 <= timeNum && timeNum < 24) || (0 <= timeNum && timeNum <= hour2)
|
||||
);
|
||||
)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** Returns whether date is in between startDate and startDate + duration (in hours) */
|
||||
export const isDateInRange = (date, startDate, duration) => {
|
||||
const endDate = new Date(startDate);
|
||||
endDate.setHours(endDate.getHours() + duration);
|
||||
return startDate <= date && date <= endDate;
|
||||
};
|
||||
const endDate = new Date(startDate)
|
||||
endDate.setHours(endDate.getHours() + duration)
|
||||
return startDate <= date && date <= endDate
|
||||
}
|
||||
|
||||
/** Converts a utc time int to a local time int based on the timezoneOffset */
|
||||
export const utcTimeToLocalTime = (
|
||||
timeNum,
|
||||
timezoneOffset = new Date().getTimezoneOffset()
|
||||
) => {
|
||||
let localTimeNum = timeNum - timezoneOffset / 60;
|
||||
localTimeNum %= 24;
|
||||
if (localTimeNum < 0) localTimeNum += 24;
|
||||
let localTimeNum = timeNum - timezoneOffset / 60
|
||||
localTimeNum %= 24
|
||||
if (localTimeNum < 0) localTimeNum += 24
|
||||
|
||||
return localTimeNum;
|
||||
};
|
||||
return localTimeNum
|
||||
}
|
||||
|
||||
/** Returns a string representing the current timezone */
|
||||
export const getCurrentTimezone = () => {
|
||||
return new Date()
|
||||
.toLocaleTimeString("en-us", { timeZoneName: "short" })
|
||||
.split(" ")[2];
|
||||
};
|
||||
.split(" ")[2]
|
||||
}
|
||||
|
||||
/**
|
||||
Returns an array of the user's calendar events for the given event, filtering for events
|
||||
only between the time ranges of the event and clamping calendar events that extend beyond the time
|
||||
ranges
|
||||
weekOffset specifies the amount of weeks forward or backward to display events for (only used for weekly schej's)
|
||||
*/
|
||||
export const getCalendarEventsByDay = async (event) => {
|
||||
let timeMin = new Date(event.dates[0]).toISOString();
|
||||
let timeMax = getDateDayOffset(
|
||||
new Date(event.dates[event.dates.length - 1]),
|
||||
2
|
||||
).toISOString();
|
||||
export const getCalendarEventsByDay = async (event, weekOffset = 0) => {
|
||||
let timeMin, timeMax
|
||||
if (event.type === eventTypes.SPECIFIC_DATES) {
|
||||
// Get all calendar events between the first date and the last date in dates
|
||||
timeMin = new Date(event.dates[0]).toISOString()
|
||||
timeMax = getDateDayOffset(
|
||||
new Date(event.dates[event.dates.length - 1]),
|
||||
2
|
||||
).toISOString()
|
||||
} else if (event.type === eventTypes.DOW) {
|
||||
// Get all calendar events for the current week offsetted by weekOffset
|
||||
const curDateWithWeekOffset = getDateDayOffset(new Date(), weekOffset * 7)
|
||||
const curDateDay = curDateWithWeekOffset.getDay()
|
||||
timeMin = getDateDayOffset(
|
||||
curDateWithWeekOffset,
|
||||
-(curDateDay + 1)
|
||||
).toISOString()
|
||||
timeMax = getDateDayOffset(timeMin, 7 + 2).toISOString()
|
||||
}
|
||||
|
||||
// Fetch calendar events from Google Calendar
|
||||
const calendarEvents = await get(
|
||||
`/user/calendar?timeMin=${timeMin}&timeMax=${timeMax}`
|
||||
);
|
||||
)
|
||||
|
||||
const calendarEventsByDay = processCalendarEvents(
|
||||
event.dates,
|
||||
event.duration,
|
||||
calendarEvents
|
||||
);
|
||||
calendarEvents,
|
||||
event.type,
|
||||
weekOffset
|
||||
)
|
||||
|
||||
return calendarEventsByDay;
|
||||
};
|
||||
return calendarEventsByDay
|
||||
}
|
||||
|
||||
/** Takes an array of calendar events and returns a new array separated by day and with hoursOffset and hoursLength properties */
|
||||
export const processCalendarEvents = (dates, duration, calendarEvents) => {
|
||||
export const processCalendarEvents = (
|
||||
dates,
|
||||
duration,
|
||||
calendarEvents,
|
||||
eventType = eventTypes.SPECIFIC_DATES,
|
||||
weekOffset = 0
|
||||
) => {
|
||||
// Put calendarEvents into the correct format
|
||||
calendarEvents = [...calendarEvents]; // Make a copy so we don't mutate original array
|
||||
calendarEvents = [...calendarEvents] // Make a copy so we don't mutate original array
|
||||
calendarEvents = calendarEvents.map((e) => {
|
||||
e.startDate = new Date(e.startDate);
|
||||
e.endDate = new Date(e.endDate);
|
||||
return e;
|
||||
});
|
||||
calendarEvents.sort((a, b) => dateCompare(a.startDate, b.startDate));
|
||||
if (eventType === eventTypes.DOW) {
|
||||
e.startDate = dateToDowDate(dates, e.startDate, weekOffset)
|
||||
e.endDate = dateToDowDate(dates, e.endDate, weekOffset)
|
||||
} else {
|
||||
e.startDate = new Date(e.startDate)
|
||||
e.endDate = new Date(e.endDate)
|
||||
}
|
||||
return e
|
||||
})
|
||||
calendarEvents.sort((a, b) => dateCompare(a.startDate, b.startDate))
|
||||
|
||||
// Format array of calendar events by day
|
||||
const calendarEventsByDay = [];
|
||||
const calendarEventsByDay = []
|
||||
for (const i in dates) {
|
||||
calendarEventsByDay[i] = [];
|
||||
calendarEventsByDay[i] = []
|
||||
}
|
||||
|
||||
// Iterate through all dates and add calendar events to array
|
||||
for (const i in dates) {
|
||||
if (calendarEvents.length == 0) break;
|
||||
if (calendarEvents.length == 0) break
|
||||
|
||||
const start = new Date(dates[i]);
|
||||
const end = new Date(start);
|
||||
end.setHours(start.getHours() + duration);
|
||||
const start = new Date(dates[i])
|
||||
const end = new Date(start)
|
||||
end.setHours(start.getHours() + duration)
|
||||
|
||||
// Keep iterating through calendar events until it's empty or there are no more events for the current date
|
||||
while (calendarEvents.length > 0 && end > calendarEvents[0].startDate) {
|
||||
let [calendarEvent] = calendarEvents.splice(0, 1);
|
||||
let [calendarEvent] = calendarEvents.splice(0, 1)
|
||||
|
||||
// Check if calendar event overlaps with event time ranges
|
||||
const startDateWithinRange = isBetween(
|
||||
calendarEvent.startDate,
|
||||
start,
|
||||
end
|
||||
);
|
||||
const endDateWithinRange = isBetween(calendarEvent.endDate, start, end);
|
||||
)
|
||||
const endDateWithinRange = isBetween(calendarEvent.endDate, start, end)
|
||||
const rangeWithinCalendarEvent =
|
||||
isBetween(start, calendarEvent.startDate, calendarEvent.endDate) &&
|
||||
isBetween(end, calendarEvent.startDate, calendarEvent.endDate);
|
||||
isBetween(end, calendarEvent.startDate, calendarEvent.endDate)
|
||||
if (
|
||||
startDateWithinRange ||
|
||||
endDateWithinRange ||
|
||||
@@ -300,43 +374,43 @@ export const processCalendarEvents = (dates, duration, calendarEvents) => {
|
||||
start,
|
||||
calendarEvent.startDate,
|
||||
calendarEvent.endDate
|
||||
);
|
||||
)
|
||||
const rangeEndWithinCalendarEvent = isBetween(
|
||||
end,
|
||||
calendarEvent.startDate,
|
||||
calendarEvent.endDate
|
||||
);
|
||||
)
|
||||
if (rangeStartWithinCalendarEvent) {
|
||||
// Clamp calendarEvent start
|
||||
calendarEvent = { ...calendarEvent, startDate: start };
|
||||
calendarEvent = { ...calendarEvent, startDate: start }
|
||||
}
|
||||
if (rangeEndWithinCalendarEvent) {
|
||||
// Clamp calendarEvent end
|
||||
calendarEvent = { ...calendarEvent, endDate: end };
|
||||
calendarEvent = { ...calendarEvent, endDate: end }
|
||||
}
|
||||
|
||||
// The number of hours since start time
|
||||
const hoursOffset =
|
||||
(calendarEvent.startDate.getTime() - start.getTime()) /
|
||||
(1000 * 60 * 60);
|
||||
(1000 * 60 * 60)
|
||||
|
||||
// The length of the event in hours
|
||||
const hoursLength =
|
||||
(calendarEvent.endDate.getTime() -
|
||||
calendarEvent.startDate.getTime()) /
|
||||
(1000 * 60 * 60);
|
||||
(1000 * 60 * 60)
|
||||
|
||||
// Don't display event if the event is 0 hours long
|
||||
if (hoursLength == 0) continue;
|
||||
if (hoursLength == 0) continue
|
||||
|
||||
calendarEventsByDay[i].push({
|
||||
...calendarEvent,
|
||||
hoursOffset,
|
||||
hoursLength,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return calendarEventsByDay;
|
||||
};
|
||||
return calendarEventsByDay
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
export * from './general_utils'
|
||||
export * from './date_utils'
|
||||
export * from './fetch_utils'
|
||||
export * from './sign_in_utils'
|
||||
export * from './location_utils'
|
||||
export * from "./general_utils"
|
||||
export * from "./date_utils"
|
||||
export * from "./fetch_utils"
|
||||
export * from "./sign_in_utils"
|
||||
export * from "./location_utils"
|
||||
@@ -1,7 +1,7 @@
|
||||
/* utils for getting user's location */
|
||||
|
||||
export const getLocation = () => {
|
||||
return fetch('https://geolocation-db.com/json/', {
|
||||
method: 'GET',
|
||||
}).then(res => res.json())
|
||||
}
|
||||
return fetch("https://geolocation-db.com/json/", {
|
||||
method: "GET",
|
||||
}).then((res) => res.json())
|
||||
}
|
||||
@@ -20,15 +20,15 @@
|
||||
<!-- Edit event dialog -->
|
||||
<NewEventDialog v-model="editEventDialog" :event="event" edit-event />
|
||||
|
||||
<div class="tw-max-w-5xl tw-mx-auto tw-mt-4">
|
||||
<div class="tw-mx-auto tw-mt-4 tw-max-w-5xl">
|
||||
<div class="tw-mx-4">
|
||||
<!-- Title and copy link -->
|
||||
<div class="tw-text-black tw-flex tw-items-center">
|
||||
<div class="tw-flex tw-items-center tw-text-black">
|
||||
<div>
|
||||
<div class="tw-text-xl sm:tw-text-3xl">{{ event.name }}</div>
|
||||
<div class="tw-flex tw-items-baseline tw-gap-1">
|
||||
<div
|
||||
class="tw-text-sm sm:tw-text-base tw-font-normal tw-text-very-dark-gray"
|
||||
class="tw-text-sm tw-font-normal tw-text-very-dark-gray sm:tw-text-base"
|
||||
>
|
||||
{{ dateString }}
|
||||
</div>
|
||||
@@ -38,7 +38,7 @@
|
||||
@click="editEvent"
|
||||
icon
|
||||
dense
|
||||
class="tw-text-green tw-min-w-0 tw-px-2 tw-text-sm sm:tw-text-base"
|
||||
class="tw-min-w-0 tw-px-2 tw-text-sm tw-text-green sm:tw-text-base"
|
||||
>
|
||||
<v-icon v-if="!isPhone" small>mdi-pencil</v-icon>
|
||||
<span v-else class="tw-underline">Edit</span>
|
||||
@@ -54,7 +54,7 @@
|
||||
class="tw-text-green"
|
||||
@click="copyLink"
|
||||
>
|
||||
<span v-if="!isPhone" class="tw-text-green tw-mr-2"
|
||||
<span v-if="!isPhone" class="tw-mr-2 tw-text-green"
|
||||
>Copy link</span
|
||||
>
|
||||
<v-icon class="tw-text-green" v-if="!isPhone"
|
||||
@@ -68,7 +68,7 @@
|
||||
<v-btn
|
||||
v-if="!authUser && selectedGuestRespondent"
|
||||
min-width="10.25rem"
|
||||
class="tw-text-white tw-bg-green"
|
||||
class="tw-bg-green tw-text-white"
|
||||
@click="editGuestAvailability"
|
||||
>
|
||||
{{ `Edit ${selectedGuestRespondent}'s availability` }}
|
||||
@@ -76,7 +76,7 @@
|
||||
<v-btn
|
||||
v-else
|
||||
width="10.25rem"
|
||||
class="tw-text-white tw-bg-green"
|
||||
class="tw-bg-green tw-text-white"
|
||||
:disabled="loading && !userHasResponded"
|
||||
@click="addAvailability"
|
||||
>
|
||||
@@ -87,14 +87,14 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<v-btn
|
||||
class="tw-text-red tw-mr-1 tw-w-20"
|
||||
class="tw-mr-1 tw-w-20 tw-text-red"
|
||||
@click="cancelEditing"
|
||||
outlined
|
||||
>
|
||||
Cancel
|
||||
</v-btn>
|
||||
<v-btn
|
||||
class="tw-text-white tw-bg-green tw-w-20"
|
||||
class="tw-w-20 tw-bg-green tw-text-white"
|
||||
@click="saveChanges"
|
||||
>
|
||||
Save
|
||||
@@ -109,10 +109,11 @@
|
||||
|
||||
<ScheduleOverlap
|
||||
ref="scheduleOverlap"
|
||||
:eventId="eventId"
|
||||
v-bind="event"
|
||||
:event="event"
|
||||
:loadingCalendarEvents="loading"
|
||||
:calendarEventsByDay="calendarEventsByDay"
|
||||
:calendarPermissionGranted="calendarPermissionGranted"
|
||||
:weekOffset.sync="weekOffset"
|
||||
@refreshEvent="refreshEvent"
|
||||
/>
|
||||
</div>
|
||||
@@ -121,14 +122,14 @@
|
||||
<!-- Bottom bar for phones -->
|
||||
<div
|
||||
v-if="isPhone"
|
||||
class="tw-flex tw-items-center tw-fixed tw-bottom-0 tw-bg-green tw-w-full tw-px-4 tw-h-16"
|
||||
class="tw-fixed tw-bottom-0 tw-flex tw-h-16 tw-w-full tw-items-center tw-bg-green tw-px-4"
|
||||
>
|
||||
<template v-if="!isEditing">
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
v-if="!authUser && selectedGuestRespondent"
|
||||
outlined
|
||||
class="tw-text-green tw-bg-white"
|
||||
class="tw-bg-white tw-text-green"
|
||||
@click="editGuestAvailability"
|
||||
>
|
||||
{{ `Edit ${selectedGuestRespondent}'s availability` }}
|
||||
@@ -136,7 +137,7 @@
|
||||
<v-btn
|
||||
v-else
|
||||
outlined
|
||||
class="tw-text-green tw-bg-white"
|
||||
class="tw-bg-white tw-text-green"
|
||||
:disabled="loading && !userHasResponded"
|
||||
@click="addAvailability"
|
||||
>
|
||||
@@ -148,7 +149,7 @@
|
||||
Cancel
|
||||
</v-btn>
|
||||
<v-spacer />
|
||||
<v-btn class="tw-text-green tw-bg-white" @click="saveChanges">
|
||||
<v-btn class="tw-bg-white tw-text-green" @click="saveChanges">
|
||||
Save
|
||||
</v-btn>
|
||||
</template>
|
||||
@@ -171,7 +172,7 @@ import { mapActions, mapState } from "vuex"
|
||||
import NewEventDialog from "@/components/NewEventDialog.vue"
|
||||
import ScheduleOverlap from "@/components/schedule_overlap/ScheduleOverlap.vue"
|
||||
import GuestDialog from "@/components/GuestDialog.vue"
|
||||
import { errors, authTypes } from "@/constants"
|
||||
import { errors, authTypes, eventTypes } from "@/constants"
|
||||
import isWebview from "is-ua-webview"
|
||||
import SignInNotSupportedDialog from "@/components/SignInNotSupportedDialog.vue"
|
||||
import MarkAvailabilityDialog from "@/components/MarkAvailabilityDialog.vue"
|
||||
@@ -205,6 +206,8 @@ export default {
|
||||
|
||||
curGuestId: "", // Id of the current guest being edited
|
||||
calendarPermissionGranted: false,
|
||||
|
||||
weekOffset: 0,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
@@ -221,6 +224,12 @@ export default {
|
||||
isPhone() {
|
||||
return isPhone(this.$vuetify)
|
||||
},
|
||||
isSpecificDates() {
|
||||
return this.event?.type === eventTypes.SPECIFIC_DATES || !this.event?.type
|
||||
},
|
||||
isWeekly() {
|
||||
return this.event?.type === eventTypes.DOW
|
||||
},
|
||||
areUnsavedChanges() {
|
||||
return this.scheduleOverlapComponent?.unsavedChanges
|
||||
},
|
||||
@@ -382,7 +391,7 @@ export default {
|
||||
}
|
||||
|
||||
// Get user's calendar
|
||||
getCalendarEventsByDay(this.event)
|
||||
getCalendarEventsByDay(this.event, this.weekOffset)
|
||||
.then((events) => {
|
||||
this.calendarEventsByDay = events
|
||||
this.loading = false
|
||||
@@ -432,6 +441,27 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
weekOffset() {
|
||||
this.loading = true
|
||||
|
||||
this.calendarEventsByDay = []
|
||||
const curWeekOffset = this.weekOffset
|
||||
getCalendarEventsByDay(this.event, curWeekOffset).then((events) => {
|
||||
// Don't set calendar events / set availability if user has already
|
||||
// selected a different weekoffset by the time these calendar events load
|
||||
if (curWeekOffset !== this.weekOffset) return
|
||||
|
||||
this.calendarEventsByDay = events
|
||||
this.loading = false
|
||||
|
||||
// Only autofill availability if user hasn't responded
|
||||
if (!this.userHasResponded) {
|
||||
this.$nextTick(() => {
|
||||
this.scheduleOverlapComponent.setAvailabilityAutomatically()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-container class="pa-5">
|
||||
<div class="tw-justify-between tw-flex tw-mb-3">
|
||||
<div class="tw-mb-3 tw-flex tw-justify-between">
|
||||
<div class="headline font-weight-bold">My friends</div>
|
||||
<div class="headline tw-text-gray">
|
||||
Requests
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
<v-text-field label="Search" outlined dense></v-text-field>
|
||||
|
||||
<FriendItem
|
||||
<FriendItem
|
||||
class="tw-mb-2"
|
||||
v-for="f, i in exampleFriends"
|
||||
v-for="(f, i) in exampleFriends"
|
||||
:key="i"
|
||||
@click="$router.push({ name: 'friend-schedule' })"
|
||||
:friend="f"
|
||||
@click="$router.push({ name: 'friend-schedule' })"
|
||||
:friend="f"
|
||||
chevron
|
||||
/>
|
||||
</v-container>
|
||||
@@ -26,7 +26,7 @@
|
||||
fab
|
||||
absolute
|
||||
dark
|
||||
class="tw-bg-blue tw-mx-auto tw-left-0 tw-right-0 tw-bottom-4"
|
||||
class="tw-left-0 tw-right-0 tw-bottom-4 tw-mx-auto tw-bg-blue"
|
||||
>
|
||||
<v-icon>mdi-account-plus</v-icon>
|
||||
</v-btn>
|
||||
@@ -35,10 +35,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FriendItem from '@/components/FriendItem'
|
||||
import FriendItem from "@/components/FriendItem"
|
||||
|
||||
export default {
|
||||
name: 'Friends',
|
||||
name: "Friends",
|
||||
|
||||
components: {
|
||||
FriendItem,
|
||||
@@ -48,18 +48,20 @@ export default {
|
||||
dialog: false,
|
||||
exampleFriends: [
|
||||
{
|
||||
name: 'Tony Xin',
|
||||
status: 'free',
|
||||
picture: 'https://media-exp1.licdn.com/dms/image/C5603AQHPyWrhwOLQ_g/profile-displayphoto-shrink_200_200/0/1632279309883?e=1658361600&v=beta&t=SF_4_hjgwSN4dlQt_EXTKVkNuuqaty5_HQRF_E7jVNo',
|
||||
name: "Tony Xin",
|
||||
status: "free",
|
||||
picture:
|
||||
"https://media-exp1.licdn.com/dms/image/C5603AQHPyWrhwOLQ_g/profile-displayphoto-shrink_200_200/0/1632279309883?e=1658361600&v=beta&t=SF_4_hjgwSN4dlQt_EXTKVkNuuqaty5_HQRF_E7jVNo",
|
||||
},
|
||||
{
|
||||
name: 'Arjun Patrawala',
|
||||
status: 'EECS 16B lecture',
|
||||
picture: 'https://media-exp1.licdn.com/dms/image/C5603AQFN3On7QKEdiA/profile-displayphoto-shrink_200_200/0/1642207771141?e=1658361600&v=beta&t=X19xF4_OS_SEHePR5HHDzGDnEVqbv3su6e9Y7QIjd0I',
|
||||
name: "Arjun Patrawala",
|
||||
status: "EECS 16B lecture",
|
||||
picture:
|
||||
"https://media-exp1.licdn.com/dms/image/C5603AQFN3On7QKEdiA/profile-displayphoto-shrink_200_200/0/1642207771141?e=1658361600&v=beta&t=X19xF4_OS_SEHePR5HHDzGDnEVqbv3su6e9Y7QIjd0I",
|
||||
},
|
||||
{
|
||||
name: 'Jacob Smith',
|
||||
status: 'Intellecture meeting',
|
||||
name: "Jacob Smith",
|
||||
status: "Intellecture meeting",
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<div class="tw-max-w-6xl tw-mx-auto tw-mb-12 tw-mt-4 sm:tw-mt-7">
|
||||
<div class="tw-mx-auto tw-mb-12 tw-mt-4 tw-max-w-6xl sm:tw-mt-7">
|
||||
<!-- Dialog -->
|
||||
<NewEventDialog v-model="dialog" />
|
||||
<div class="tw-grid tw-p-4 tw-gap-4 sm:tw-gap-8">
|
||||
<div class="tw-grid tw-gap-4 tw-p-4 sm:tw-gap-8">
|
||||
<EventType
|
||||
v-for="(eventType, t) in events"
|
||||
:key="t"
|
||||
@@ -22,6 +22,7 @@ import NewEventDialog from "@/components/NewEventDialog.vue"
|
||||
import EventType from "@/components/EventType.vue"
|
||||
import BottomFab from "@/components/BottomFab.vue"
|
||||
import { mapState, mapActions } from "vuex"
|
||||
import { eventTypes } from "@/constants"
|
||||
|
||||
export default {
|
||||
name: "Home",
|
||||
@@ -40,9 +41,17 @@ export default {
|
||||
...mapState(["createdEvents", "joinedEvents"]),
|
||||
events() {
|
||||
return [
|
||||
...(this.createdWeeklyEvents.length > 0
|
||||
? [
|
||||
{
|
||||
header: "Weekly",
|
||||
events: this.createdWeeklyEvents,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
header: "Events I created",
|
||||
events: this.createdEvents,
|
||||
events: this.createdEventsWithSpecificDates,
|
||||
},
|
||||
{
|
||||
header: "Events I joined",
|
||||
@@ -50,6 +59,12 @@ export default {
|
||||
},
|
||||
]
|
||||
},
|
||||
createdEventsWithSpecificDates() {
|
||||
return this.createdEvents.filter((e) => e.type !== eventTypes.DOW)
|
||||
},
|
||||
createdWeeklyEvents() {
|
||||
return this.createdEvents.filter((e) => e.type === eventTypes.DOW)
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
class="tw-min-h-screen tw-flex tw-flex-col tw-max-w-6xl tw-m-auto tw-relative"
|
||||
class="tw-relative tw-m-auto tw-flex tw-min-h-screen tw-max-w-6xl tw-flex-col"
|
||||
>
|
||||
<!-- Green background -->
|
||||
<div
|
||||
class="tw-bg-green tw-absolute tw-w-screen tw-left-1/2 -tw-translate-x-1/2 tw-bottom-0 tw-h-[40%] sm:tw-h-[47%]"
|
||||
class="tw-absolute tw-left-1/2 tw-bottom-0 tw-h-[40%] tw-w-screen -tw-translate-x-1/2 tw-bg-green sm:tw-h-[47%]"
|
||||
></div>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="tw-mb-16">
|
||||
<div class="tw-pt-5 tw-px-5 tw-flex tw-items-center">
|
||||
<div class="tw-flex tw-items-center tw-px-5 tw-pt-5">
|
||||
<v-img
|
||||
alt="schej Logo"
|
||||
class="shrink tw-cursor-pointer"
|
||||
@@ -28,24 +28,24 @@
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="tw-flex tw-justify-center lg:tw-justify-between tw-relative tw-pb-12 lg:tw-pb-24"
|
||||
class="tw-relative tw-flex tw-justify-center tw-pb-12 lg:tw-justify-between lg:tw-pb-24"
|
||||
>
|
||||
<!-- Left side -->
|
||||
<div class="tw-flex tw-flex-col">
|
||||
<!-- Hero -->
|
||||
<div
|
||||
class="tw-max-w-[26rem] sm:tw-max-w-none tw-flex tw-flex-col tw-items-start lg:tw-mb-20 tw-mx-4"
|
||||
class="tw-mx-4 tw-flex tw-max-w-[26rem] tw-flex-col tw-items-start sm:tw-max-w-none lg:tw-mb-20"
|
||||
>
|
||||
<div
|
||||
id="header"
|
||||
class="tw-text-left tw-text-2xl sm:tw-text-4xl lg:tw-text-4xl xl:tw-text-5xl tw-font-medium tw-mb-4"
|
||||
class="tw-mb-4 tw-text-left tw-text-2xl tw-font-medium sm:tw-text-4xl lg:tw-text-4xl xl:tw-text-5xl"
|
||||
>
|
||||
<div class="tw-leading-snug">Finding a time to meet,</div>
|
||||
<div class="tw-leading-snug">made simple.</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="tw-text-left tw-text-sm sm:tw-text-lg md:tw-text-lg lg:tw-text-md xl:tw-text-lg tw-text-very-dark-gray tw-mb-4"
|
||||
class="lg:tw-text-md tw-mb-4 tw-text-left tw-text-sm tw-text-very-dark-gray sm:tw-text-lg md:tw-text-lg xl:tw-text-lg"
|
||||
>
|
||||
<b>Automatically</b> fill out your availability with Google
|
||||
Calendar—<br v-if="!isPhone" />
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
<v-btn
|
||||
id="lets-schej-it-btn"
|
||||
class="tw-text-base tw-my-6 tw-self-center tw-block lg:tw-hidden tw-bg-green tw-rounded-lg tw-px-10 sm:tw-px-10 lg:tw-px-12"
|
||||
class="tw-my-6 tw-block tw-self-center tw-rounded-lg tw-bg-green tw-px-10 tw-text-base sm:tw-px-10 lg:tw-hidden lg:tw-px-12"
|
||||
dark
|
||||
@click="newEventDialog = true"
|
||||
large
|
||||
@@ -82,11 +82,11 @@
|
||||
<!-- How it works -->
|
||||
<div
|
||||
id="how-it-works"
|
||||
class="tw-pt-12 tw-grid tw-place-content-center tw-px-4"
|
||||
class="tw-grid tw-place-content-center tw-px-4 tw-pt-12"
|
||||
>
|
||||
<div class="tw-flex tw-flex-col tw-gap-4 tw-mx-auto">
|
||||
<div class="tw-mx-auto tw-flex tw-flex-col tw-gap-4">
|
||||
<div
|
||||
class="tw-text-center tw-text-2xl sm:tw-text-3xl lg:tw-text-4xl tw-font-medium tw-mb-4"
|
||||
class="tw-mb-4 tw-text-center tw-text-2xl tw-font-medium sm:tw-text-3xl lg:tw-text-4xl"
|
||||
>
|
||||
How it works
|
||||
</div>
|
||||
@@ -96,10 +96,10 @@
|
||||
class="tw-flex tw-items-center tw-gap-2"
|
||||
>
|
||||
<NumberBullet>{{ i + 1 }}</NumberBullet>
|
||||
<div class="md:tw-text-xl tw-text-base tw-font-medium">
|
||||
<div class="tw-text-base tw-font-medium md:tw-text-xl">
|
||||
<div v-if="i == 1">
|
||||
<span
|
||||
class="tw-cursor-pointer tw-underline tw-decoration-pale-green hover:tw-decoration-green tw-decoration-4"
|
||||
class="tw-cursor-pointer tw-underline tw-decoration-pale-green tw-decoration-4 hover:tw-decoration-green"
|
||||
style="text-underline-position: under"
|
||||
@click="confetti"
|
||||
>
|
||||
@@ -112,7 +112,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="tw-mt-10 tw-mb-6 md:tw-mt-20 md:tw-mb-12 tw-text-3xl md:tw-text-6xl tw-font-medium tw-text-center"
|
||||
class="tw-mt-10 tw-mb-6 tw-text-center tw-text-3xl tw-font-medium md:tw-mt-20 md:tw-mb-12 md:tw-text-6xl"
|
||||
>
|
||||
It's that simple.
|
||||
</div>
|
||||
@@ -128,11 +128,11 @@
|
||||
|
||||
<!-- Video -->
|
||||
<div
|
||||
class="tw-flex tw-bg-green tw-px-4 tw-pt-24 tw-pb-12 md:tw-pb-16 tw-justify-center"
|
||||
class="tw-flex tw-justify-center tw-bg-green tw-px-4 tw-pt-24 tw-pb-12 md:tw-pb-16"
|
||||
>
|
||||
<div class="md:tw-h-96 sm:tw-h-80 tw-h-64 tw-max-w-3xl tw-flex-1">
|
||||
<div class="tw-h-64 tw-max-w-3xl tw-flex-1 sm:tw-h-80 md:tw-h-96">
|
||||
<iframe
|
||||
class="tw-w-full tw-h-full"
|
||||
class="tw-h-full tw-w-full"
|
||||
src="https://www.youtube.com/embed/Wzth9Ov7bkI?fs=0&color=white&rel=0&controls=0"
|
||||
title="schej demo"
|
||||
frameborder="0"
|
||||
@@ -144,8 +144,8 @@
|
||||
|
||||
<!-- FAQ -->
|
||||
<div class="tw-flex tw-justify-center tw-pt-12">
|
||||
<div class="tw-flex-1 tw-mx-4 sm:tw-mx-16 tw-mb-12 tw-max-w-3xl">
|
||||
<div id="faq-section" class="lg:tw-pt-3 tw-text-center">
|
||||
<div class="tw-mx-4 tw-mb-12 tw-max-w-3xl tw-flex-1 sm:tw-mx-16">
|
||||
<div id="faq-section" class="tw-text-center lg:tw-pt-3">
|
||||
<Header> Frequently Asked Questions </Header>
|
||||
<div
|
||||
class="tw-grid tw-grid-cols-1 tw-gap-3 sm:tw-text-xl lg:tw-text-2xl"
|
||||
@@ -157,13 +157,13 @@
|
||||
</div>
|
||||
|
||||
<!-- Privacy Policy -->
|
||||
<div class="tw-bg-green tw-flex tw-flex-col">
|
||||
<div class="tw-flex tw-flex-col tw-bg-green">
|
||||
<div
|
||||
class="tw-flex tw-flex-col tw-gap-4 tw-items-center tw-m-2 tw-pt-6 tw-pb-6"
|
||||
class="tw-m-2 tw-flex tw-flex-col tw-items-center tw-gap-4 tw-pt-6 tw-pb-6"
|
||||
>
|
||||
<router-link
|
||||
class="tw-text-white tw-font-bold"
|
||||
:to="{ path: 'privacy-policy' }"
|
||||
class="tw-font-bold tw-text-white"
|
||||
:to="{ name: 'privacy-policy' }"
|
||||
>
|
||||
Privacy Policy
|
||||
</router-link>
|
||||
@@ -177,7 +177,7 @@
|
||||
<v-card-title>Sign in</v-card-title>
|
||||
<v-card-text class="tw-flex tw-flex-col tw-items-center">
|
||||
<SignInGoogleBtn class="tw-mb-4" @click="signInGoogle" dark />
|
||||
<div class="tw-text-xs tw-text-center">
|
||||
<div class="tw-text-center tw-text-xs">
|
||||
By continuing, you agree to our
|
||||
<router-link class="tw-text-blue" :to="{ name: 'privacy-policy' }"
|
||||
>privacy policy</router-link
|
||||
|
||||
@@ -1,273 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog" :width="400">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span v-if="dialogType === DIALOG_TYPES.SIGN_IN">Sign in</span>
|
||||
<span v-else-if="dialogType === DIALOG_TYPES.SIGN_UP">Sign up</span>
|
||||
</v-card-title>
|
||||
<v-card-text class="tw-flex tw-flex-col tw-items-center">
|
||||
<SignInGoogleBtn @click="signInGoogle" dark />
|
||||
<div class="tw-text-xs tw-text-center">
|
||||
By continuing, you agree to our
|
||||
<router-link class="tw-text-blue" :to="{ name: 'privacy-policy' }"
|
||||
>privacy policy</router-link
|
||||
>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<div class="tw-min-h-screen tw-flex tw-flex-col">
|
||||
<!-- Header -->
|
||||
<div class="tw-mb-12">
|
||||
<div
|
||||
class="tw-pt-5 tw-px-5 tw-flex tw-items-center tw-max-w-6xl tw-m-auto"
|
||||
>
|
||||
<v-img
|
||||
alt="schej Logo"
|
||||
class="shrink tw-cursor-pointer"
|
||||
contain
|
||||
src="@/assets/schej_logo_with_text.png"
|
||||
transition="scale-transition"
|
||||
:width="logoWidth"
|
||||
/>
|
||||
|
||||
<v-spacer />
|
||||
|
||||
<v-btn text href="#how-it-works">How it works</v-btn>
|
||||
<v-btn text @click="signIn">Sign in</v-btn>
|
||||
</div>
|
||||
|
||||
<!-- Hero -->
|
||||
<div class="tw-flex tw-flex-col tw-items-center">
|
||||
<div
|
||||
class="tw-mt-16 tw-mb-4 sm:tw-mb-8 lg:tw-mb-10 tw-text-2xl sm:tw-text-5xl lg:tw-text-6xl tw-font-medium tw-text-center"
|
||||
>
|
||||
<div class="tw-leading-tight">Finding a time to meet,</div>
|
||||
<div class="tw-leading-snug">made simple.</div>
|
||||
</div>
|
||||
<v-btn
|
||||
id="lets-schej-it-btn"
|
||||
class="tw-bg-green tw-rounded-lg tw-px-6 sm:tw-px-10 lg:tw-px-12"
|
||||
dark
|
||||
@click="$router.push({ name: 'createEvent'})"
|
||||
:large="$vuetify.breakpoint.smAndUp"
|
||||
:x-large="$vuetify.breakpoint.mdAndUp"
|
||||
>
|
||||
Let's schej it
|
||||
</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calendar -->
|
||||
<div
|
||||
class="tw-flex-1 md:tw-flex md:tw-justify-center tw-relative tw-pb-12"
|
||||
>
|
||||
<div
|
||||
class="tw-absolute tw-bg-green tw-w-full"
|
||||
style="top: 10rem; height: calc(100% - 10rem)"
|
||||
></div>
|
||||
<div>
|
||||
<LandingPageCalendar />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- How it works -->
|
||||
<div
|
||||
id="how-it-works"
|
||||
class="tw-pt-12 tw-grid tw-place-content-center tw-px-4"
|
||||
>
|
||||
<div class="tw-flex tw-flex-col tw-gap-4 tw-mx-auto">
|
||||
<div
|
||||
class="tw-text-center tw-text-2xl sm:tw-text-3xl lg:tw-text-4xl tw-font-medium tw-mb-4"
|
||||
>
|
||||
How it works
|
||||
</div>
|
||||
<div
|
||||
v-for="(step, i) in howItWorksSteps"
|
||||
:key="i"
|
||||
class="tw-flex tw-items-center tw-gap-2"
|
||||
>
|
||||
<NumberBullet>{{ i + 1 }}</NumberBullet>
|
||||
<div class="md:tw-text-xl tw-text-base tw-font-medium">
|
||||
<div v-if="i == 1">
|
||||
<span
|
||||
class="tw-cursor-pointer tw-underline tw-decoration-pale-green hover:tw-decoration-green tw-decoration-4"
|
||||
style="text-underline-position: under"
|
||||
@click="confetti"
|
||||
>Automatically</span
|
||||
>
|
||||
fill out your availability with Google Calendar,
|
||||
</div>
|
||||
<div v-else v-html="step"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="tw-mt-10 tw-mb-6 md:tw-mt-20 md:tw-mb-12 tw-text-3xl md:tw-text-6xl tw-font-medium tw-text-center"
|
||||
>
|
||||
It's that simple.
|
||||
</div>
|
||||
<v-img
|
||||
alt="schej character"
|
||||
src="@/assets/schej_character.png"
|
||||
:height="isPhone ? 200 : 300"
|
||||
transition="fade-transition"
|
||||
contain
|
||||
class="-tw-mb-12"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Video -->
|
||||
<div
|
||||
class="tw-flex tw-bg-green tw-px-4 tw-pt-24 tw-pb-12 md:tw-pb-12 tw-justify-center"
|
||||
>
|
||||
<div class="md:tw-h-96 sm:tw-h-80 tw-h-64 tw-max-w-3xl tw-flex-1">
|
||||
<iframe
|
||||
class="tw-w-full tw-h-full"
|
||||
src="https://www.youtube.com/embed/Wzth9Ov7bkI?fs=0&color=white&rel=0&controls=0"
|
||||
title="Demo of Schej"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- FAQ -->
|
||||
<div class="tw-flex tw-justify-center tw-pt-12">
|
||||
<div class="tw-flex-1 tw-mx-4 sm:tw-mx-16 tw-mb-12 tw-max-w-3xl">
|
||||
<div id="faq-section" class="lg:tw-pt-3 tw-text-center">
|
||||
<Header> Frequently Asked Questions </Header>
|
||||
<div
|
||||
class="tw-grid tw-grid-cols-1 tw-gap-3 sm:tw-text-xl lg:tw-text-2xl"
|
||||
>
|
||||
<FAQ v-for="faq in faqs" :key="faq.question" v-bind="faq" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Privacy Policy -->
|
||||
<div class="tw-bg-green tw-flex tw-flex-col">
|
||||
<div
|
||||
class="tw-flex tw-flex-row tw-justify-around tw-m-2 tw-py-4 tw-font-medium"
|
||||
>
|
||||
<a class="tw-text-white" href="#how-it-works">How it works</a>
|
||||
<router-link class="tw-text-white" :to="{ path: 'privacy-policy' }"
|
||||
>Privacy Policy</router-link
|
||||
>
|
||||
<a class="tw-text-white" @click="signIn">Sign in</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LandingPageCalendar from "@/components/LandingPageCalendar.vue"
|
||||
import { isPhone, signInGoogle } from "@/utils"
|
||||
import SignInGoogleBtn from "@/components/SignInGoogleBtn.vue"
|
||||
import FAQ from "@/components/FAQ.vue"
|
||||
import Header from "@/components/Header.vue"
|
||||
import NumberBullet from "@/components/NumberBullet.vue"
|
||||
import { confetti } from "tsparticles-confetti"
|
||||
|
||||
export default {
|
||||
name: "Landing",
|
||||
|
||||
components: {
|
||||
LandingPageCalendar,
|
||||
SignInGoogleBtn,
|
||||
FAQ,
|
||||
Header,
|
||||
NumberBullet,
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
dialog: false,
|
||||
dialogType: 0,
|
||||
DIALOG_TYPES: {
|
||||
SIGN_IN: 0,
|
||||
SIGN_UP: 1,
|
||||
},
|
||||
howItWorksSteps: [
|
||||
"Create a schej",
|
||||
"",
|
||||
"Share the schej and find the best time to meet!",
|
||||
],
|
||||
faqs: [
|
||||
{
|
||||
question: "Do I need to sign in with Google in order to use schej?",
|
||||
answer:
|
||||
"Signing in with Google is required to create events, but anybody can add their availability once an event is created, whether or not they are signed in with Google!",
|
||||
},
|
||||
{
|
||||
question: "How is schej different from lettucemeet or when2meet?",
|
||||
points: [
|
||||
"Much better UI (web and mobile)",
|
||||
"Seemless and working calendar integration",
|
||||
"No ads :)",
|
||||
],
|
||||
},
|
||||
{
|
||||
question: "Is Google Calendar access required in order to use schej?",
|
||||
answer:
|
||||
"Nope! You can manually input your availability, but we highly recommend allowing Google Calendar access in order to view your calendar events while doing so.",
|
||||
},
|
||||
{
|
||||
question: "Will other people be able to see my calendar events?",
|
||||
answer:
|
||||
"Nope! All other users will be able to see is the availability that you enter for an event.",
|
||||
},
|
||||
{
|
||||
question: "How do I edit my availability?",
|
||||
answer:
|
||||
'If you are signed in, simply click the "Edit availability" button. If you entered your availability as a guest, click on your name first and then "Edit availability".',
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
computed: {
|
||||
isPhone() {
|
||||
return isPhone(this.$vuetify)
|
||||
},
|
||||
logoWidth() {
|
||||
return 90
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
confetti() {
|
||||
confetti({
|
||||
spread: 360,
|
||||
ticks: 1000,
|
||||
// count: 100,
|
||||
shapes: ["image"],
|
||||
scalar: 5,
|
||||
shapeOptions: {
|
||||
image: [
|
||||
{
|
||||
src: require("@/assets/schej_logo.png"),
|
||||
width: 32,
|
||||
height: 32,
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
},
|
||||
signInGoogle() {
|
||||
signInGoogle({ state: null, selectAccount: true })
|
||||
},
|
||||
signIn() {
|
||||
this.dialog = true
|
||||
this.dialogType = this.DIALOG_TYPES.SIGN_IN
|
||||
},
|
||||
getStarted() {
|
||||
this.dialog = true
|
||||
this.dialogType = this.DIALOG_TYPES.SIGN_UP
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -1,4 +1,4 @@
|
||||
const colors = require("tailwindcss/colors");
|
||||
const colors = require("tailwindcss/colors")
|
||||
|
||||
module.exports = {
|
||||
content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
|
||||
@@ -36,4 +36,4 @@ module.exports = {
|
||||
},
|
||||
plugins: [],
|
||||
prefix: "tw-",
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
const { defineConfig } = require("@vue/cli-service")
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: [
|
||||
'vuetify'
|
||||
]
|
||||
transpileDependencies: ["vuetify"],
|
||||
})
|
||||
@@ -244,6 +244,9 @@ var doc = `{
|
||||
},
|
||||
"notificationsEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.EventType"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -343,6 +346,9 @@ var doc = `{
|
||||
},
|
||||
"notificationsEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.EventType"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1014,9 +1020,15 @@ var doc = `{
|
||||
"description": "Scheduled event",
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.CalendarEvent"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.EventType": {
|
||||
"type": "string"
|
||||
},
|
||||
"models.FriendRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -228,6 +228,9 @@
|
||||
},
|
||||
"notificationsEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.EventType"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,6 +330,9 @@
|
||||
},
|
||||
"notificationsEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/models.EventType"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -998,9 +1004,15 @@
|
||||
"description": "Scheduled event",
|
||||
"type": "object",
|
||||
"$ref": "#/definitions/models.CalendarEvent"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.EventType": {
|
||||
"type": "string"
|
||||
},
|
||||
"models.FriendRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -37,7 +37,11 @@ definitions:
|
||||
$ref: '#/definitions/models.CalendarEvent'
|
||||
description: Scheduled event
|
||||
type: object
|
||||
type:
|
||||
type: string
|
||||
type: object
|
||||
models.EventType:
|
||||
type: string
|
||||
models.FriendRequest:
|
||||
properties:
|
||||
_id:
|
||||
@@ -256,6 +260,8 @@ paths:
|
||||
type: string
|
||||
notificationsEnabled:
|
||||
type: boolean
|
||||
type:
|
||||
$ref: '#/definitions/models.EventType'
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
@@ -329,6 +335,8 @@ paths:
|
||||
type: string
|
||||
notificationsEnabled:
|
||||
type: boolean
|
||||
type:
|
||||
$ref: '#/definitions/models.EventType'
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
|
||||
+11
-2
@@ -2,6 +2,13 @@ package models
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
type EventType string
|
||||
|
||||
const (
|
||||
SPECIFIC_DATES EventType = "specific_dates"
|
||||
DOW EventType = "dow"
|
||||
)
|
||||
|
||||
// Representation of an Event in the mongoDB database
|
||||
type Event struct {
|
||||
Id primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
|
||||
@@ -12,12 +19,14 @@ type Event struct {
|
||||
Dates []primitive.DateTime `json:"dates" bson:"dates,omitempty"`
|
||||
NotificationsEnabled bool `json:"notificationsEnabled" bson:"notificationsEnabled,omitempty"`
|
||||
|
||||
Type EventType `json:"type" bson:"type,omitempty"`
|
||||
|
||||
// Availability responses
|
||||
Responses map[string]*Response `json:"responses" bson:"responses"`
|
||||
|
||||
// Scheduled event
|
||||
ScheduledEvent *CalendarEvent `json:"scheduledEvent" bson:"scheduledEvent,omitempty"`
|
||||
CalendarEventId string `json:"calendarEventId" bson:"calendarEventId,omitempty"`
|
||||
ScheduledEvent *CalendarEvent `json:"scheduledEvent" bson:"scheduledEvent,omitempty"`
|
||||
CalendarEventId string `json:"calendarEventId" bson:"calendarEventId,omitempty"`
|
||||
}
|
||||
|
||||
// A response object containing an array of times that the given user is available
|
||||
|
||||
@@ -36,7 +36,7 @@ func InitEvents(router *gin.Engine) {
|
||||
// @Tags events
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param payload body object{name=string,duration=float32,dates=[]primitive.DateTime,notificationsEnabled=bool} true "Object containing info about the event to create"
|
||||
// @Param payload body object{name=string,duration=float32,dates=[]string,notificationsEnabled=bool,type=models.EventType} true "Object containing info about the event to create"
|
||||
// @Success 201 {object} object{eventId=string}
|
||||
// @Router /events [post]
|
||||
func createEvent(c *gin.Context) {
|
||||
@@ -45,6 +45,7 @@ func createEvent(c *gin.Context) {
|
||||
Duration *float32 `json:"duration" binding:"required"`
|
||||
Dates []primitive.DateTime `json:"dates" binding:"required"`
|
||||
NotificationsEnabled *bool `json:"notificationsEnabled" binding:"required"`
|
||||
Type models.EventType `json:"type" binding:"required"`
|
||||
}{}
|
||||
if err := c.Bind(&payload); err != nil {
|
||||
return
|
||||
@@ -67,6 +68,7 @@ func createEvent(c *gin.Context) {
|
||||
Duration: payload.Duration,
|
||||
Dates: payload.Dates,
|
||||
NotificationsEnabled: *payload.NotificationsEnabled,
|
||||
Type: payload.Type,
|
||||
Responses: make(map[string]*models.Response),
|
||||
}
|
||||
|
||||
@@ -283,7 +285,7 @@ func scheduleEvent(c *gin.Context) {
|
||||
// @Tags events
|
||||
// @Produce json
|
||||
// @Param eventId path string true "Event ID"
|
||||
// @Param payload body object{name=string,duration=float32,dates=[]primitive.DateTime,notificationsEnabled=bool} true "Object containing info about the event to update"
|
||||
// @Param payload body object{name=string,duration=float32,dates=[]string,notificationsEnabled=bool,type=models.EventType} true "Object containing info about the event to update"
|
||||
// @Success 200
|
||||
// @Router /events/{eventId} [put]
|
||||
func editEvent(c *gin.Context) {
|
||||
@@ -292,6 +294,7 @@ func editEvent(c *gin.Context) {
|
||||
Duration *float32 `json:"duration" binding:"required"`
|
||||
Dates []primitive.DateTime `json:"dates" binding:"required"`
|
||||
NotificationsEnabled *bool `json:"notificationsEnabled" binding:"required"`
|
||||
Type models.EventType `json:"type" binding:"required"`
|
||||
}{}
|
||||
if err := c.Bind(&payload); err != nil {
|
||||
return
|
||||
@@ -320,6 +323,7 @@ func editEvent(c *gin.Context) {
|
||||
"duration": payload.Duration,
|
||||
"dates": payload.Dates,
|
||||
"notificationsEnabled": *payload.NotificationsEnabled,
|
||||
"type": payload.Type,
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/gin-contrib/sessions"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"schej.it/server/db"
|
||||
"schej.it/server/logger"
|
||||
"schej.it/server/middleware"
|
||||
@@ -59,12 +60,13 @@ func getEvents(c *gin.Context) {
|
||||
|
||||
// Get the events associated with the current user
|
||||
events := make([]models.Event, 0)
|
||||
opts := options.Find().SetSort(bson.M{"_id": -1})
|
||||
cursor, err := db.EventsCollection.Find(context.Background(), bson.M{
|
||||
"$or": bson.A{
|
||||
bson.M{"ownerId": userId},
|
||||
bson.M{"responses." + userIdString: bson.M{"$exists": true}},
|
||||
},
|
||||
})
|
||||
}, opts)
|
||||
if err != nil {
|
||||
logger.StdErr.Panicln(err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"schej.it/server/db"
|
||||
"schej.it/server/models"
|
||||
)
|
||||
|
||||
func main() {
|
||||
closeConnection := db.Init()
|
||||
defer closeConnection()
|
||||
|
||||
_, err := db.EventsCollection.UpdateMany(context.Background(), bson.M{"type": nil}, bson.M{
|
||||
"$set": bson.M{"type": models.SPECIFIC_DATES},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user