-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from eddimull/eventVisualTweaks
Event visual tweaks
- Loading branch information
Showing
4 changed files
with
211 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,79 @@ | ||
<template> | ||
<div class="max-w-md mx-auto bg-white dark:bg-slate-700 dark:border-gray-200 shadow-lg rounded-lg overflow-hidden"> | ||
<ul class="divide-y divide-gray-200"> | ||
<li v-for="(time, index) in sortedTimes" :key="time.title" class="relative"> | ||
<div class="flex items-center p-4"> | ||
<div class="flex-shrink-0 w-12 h-12 bg-blue-500 rounded-full flex items-center justify-center"> | ||
<span class="text-white font-semibold text-lg">{{ index + 1 }}</span> | ||
</div> | ||
<div class="ml-4 flex-grow"> | ||
<p class="text-sm font-medium text-gray-900 dark:text-white">{{ time.title }}</p> | ||
<p class="text-sm text-gray-500">{{ formatTime(time.time) }}</p> | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
<div | ||
class="max-w-md mx-auto bg-white dark:bg-slate-700 dark:border-gray-200 shadow-lg rounded-lg overflow-hidden" | ||
> | ||
<ul class="divide-y divide-gray-200"> | ||
<li | ||
v-for="(time, index) in sortedTimes" | ||
:key="time.title" | ||
class="relative" | ||
> | ||
<div class="flex items-center p-4"> | ||
<div | ||
class="flex-shrink-0 w-12 h-12 bg-blue-500 rounded-full flex items-center justify-center" | ||
:class="{ | ||
'border-2 border-white': time.title === 'Show Time', | ||
}" | ||
> | ||
<span class="text-white font-semibold text-lg">{{ | ||
index + 1 | ||
}}</span> | ||
</div> | ||
<div class="ml-4 flex-grow"> | ||
<p | ||
:class="{ | ||
'font-bold': time.title === 'Show Time', | ||
}" | ||
class="text-sm font-medium text-gray-900 dark:text-white" | ||
> | ||
{{ time.title }} | ||
</p> | ||
<p class="text-sm text-gray-500 dark:text-gray-400"> | ||
{{ formatTime(time.time) }} | ||
</p> | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { computed } from 'vue'; | ||
import { computed } from "vue"; | ||
const props = defineProps({ | ||
times: { | ||
type: Object, | ||
required: true | ||
} | ||
times: { | ||
type: Object, | ||
required: true, | ||
}, | ||
eventDate: { | ||
type: String, | ||
required: true, | ||
}, | ||
eventTime: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
const sortedTimes = computed(() => { | ||
function showTime(dateString, timeString) { | ||
this.time = `${dateString} ${timeString}`; | ||
this.title = "Show Time"; | ||
} | ||
if (!props.times || !Array.isArray(props.times)) { | ||
return []; | ||
} | ||
const sortedTimes = computed(() => { | ||
if (!props.times || !Array.isArray(props.times)) { | ||
return []; | ||
} | ||
return [...props.times].sort((a, b) => new Date(a.time) - new Date(b.time)); | ||
return [ | ||
...props.times, | ||
new showTime(props.eventDate, props.eventTime), | ||
].sort((a, b) => new Date(a.time) - new Date(b.time)); | ||
}); | ||
const formatTime = (timeString) => { | ||
const date = new Date(timeString); | ||
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); | ||
const date = new Date(timeString); | ||
return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); | ||
}; | ||
</script> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,84 @@ | ||
<template> | ||
<div class="border-b-2 pt-1 pb-3 grid grid-cols-2 items-center"> | ||
<div class="flex flex-col min-[320px]:flex-row items-start min-[320px]:items-center"> | ||
<div class="mb-2 sm:mb-0 sm:mr-3"> | ||
<card-icon :type="type" /> | ||
</div> | ||
<div class="flex flex-col -mr-20"> | ||
<div class="font-bold break-words"> | ||
{{ name }} | ||
<div class="border-b-2 pt-1 pb-3 grid grid-cols-2 items-center"> | ||
<div | ||
class="flex flex-col min-[320px]:flex-row items-start min-[320px]:items-center" | ||
> | ||
<div class="mb-2 sm:mb-0 sm:mr-3"> | ||
<card-icon :type="type" /> | ||
</div> | ||
<div class="flex flex-col -mr-20"> | ||
<div class="font-bold break-words"> | ||
{{ name }} | ||
</div> | ||
<div class="text-gray-400 text-sm font-bold"> | ||
{{ parsedDate.date }} | ||
<span class="sm:inline">- {{ parsedDate.day }}</span> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="text-gray-400 text-sm font-bold"> | ||
{{ parsedDate.date }} <span class="hidden sm:inline">- {{ parsedDate.day }}</span> | ||
<div class="ml-4 text-right pr-4"> | ||
<span | ||
class="text-2xl font-bold leading-none cursor-pointer select-none" | ||
@click="confirmEdit(name)" | ||
>…</span | ||
> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="ml-4 text-right pr-4"> | ||
<span | ||
class="text-2xl font-bold leading-none cursor-pointer select-none" | ||
@click="confirmEdit(name)" | ||
>…</span> | ||
</div> | ||
</div> | ||
</template> | ||
<script> | ||
import CardIcon from './CardIcon.vue' | ||
import moment from 'moment' | ||
import CardIcon from "./CardIcon.vue"; | ||
import moment from "moment"; | ||
export default { | ||
components:{ | ||
CardIcon | ||
components: { | ||
CardIcon, | ||
}, | ||
props: { | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
type: { | ||
type: String, | ||
required: true, | ||
}, | ||
date: { | ||
type: String, | ||
required: true, | ||
}, | ||
eventkey: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
props:{ | ||
name: { | ||
type: String, | ||
required: true | ||
}, | ||
type: { | ||
type: String, | ||
required: true | ||
}, | ||
date: { | ||
type: String, | ||
required: true | ||
}, | ||
eventkey: { | ||
type: String, | ||
required: true | ||
} | ||
data() { | ||
return { | ||
showEditModal: false, | ||
parsedDate: moment().format("mm-dd-yyyy"), | ||
}; | ||
}, | ||
data(){ | ||
return{ | ||
showEditModal:false, | ||
parsedDate:moment().format('mm-dd-yyyy') | ||
} | ||
created() { | ||
this.parsedDate = { | ||
date: moment(this.date).format("MM-DD-YYYY"), | ||
day: moment(this.date).format("(ddd)"), | ||
}; | ||
}, | ||
created(){ | ||
this.parsedDate = { | ||
date: moment(this.date).format('MM-DD-YYYY'), | ||
day: moment(this.date).format('(ddd)'), | ||
} | ||
methods: { | ||
confirmEdit(name) { | ||
this.$swal | ||
.fire({ | ||
title: `Edit`, | ||
html: `Would you like to edit <strong>"${name}"</strong>?`, | ||
showCancelButton: true, | ||
confirmButtonColor: "#3085d6", | ||
cancelButtonColor: "#d33", | ||
confirmButtonText: "Yes", | ||
}) | ||
.then((result) => { | ||
if (result.value) { | ||
this.$inertia.get(`/events/${this.eventkey}/edit`); | ||
} | ||
}); | ||
}, | ||
}, | ||
methods:{ | ||
confirmEdit(name){ | ||
this.$swal.fire({ | ||
title: `Edit`, | ||
html: `Would you like to edit <strong>"${name}"</strong>?`, | ||
showCancelButton: true, | ||
confirmButtonColor: '#3085d6', | ||
cancelButtonColor: '#d33', | ||
confirmButtonText: 'Yes' | ||
}).then((result) => { | ||
if (result.value) { | ||
this.$inertia.get(`/events/${this.eventkey}/edit`); | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
</script> | ||
}; | ||
</script> |
Oops, something went wrong.