Skip to content

Commit

Permalink
Merge pull request #129 from eddimull/eventVisualTweaks
Browse files Browse the repository at this point in the history
Event visual tweaks
  • Loading branch information
eddimull authored Dec 10, 2024
2 parents f105cc0 + 9b98925 commit 8656322
Show file tree
Hide file tree
Showing 4 changed files with 211 additions and 126 deletions.
6 changes: 5 additions & 1 deletion resources/js/Components/Event/Card/Body.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
</li>
<li class="p-2">
Timeline:
<Times :times="event.additional_data?.times" />
<Times
:event-time="event.time"
:event-date="event.date"
:times="event.additional_data?.times"
/>
</li>
<li v-if="event.notes !== null" class="p-2">
Notes:
Expand Down
93 changes: 65 additions & 28 deletions resources/js/Components/Event/Card/Components/Times.vue
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>
140 changes: 73 additions & 67 deletions resources/js/Components/Event/Card/Header.vue
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)"
>&#8230;</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)"
>&#8230;</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>
Loading

0 comments on commit 8656322

Please sign in to comment.