Skip to content

Commit

Permalink
Merge pull request #83 from gdsc-ncku/jason
Browse files Browse the repository at this point in the history
fix: add missing api fields for SaveScheduleButton
  • Loading branch information
jason810496 authored Feb 28, 2024
2 parents 7485c80 + 122db2f commit 655cce1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 29 deletions.
27 changes: 17 additions & 10 deletions src/components/SaveScheduleButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ let props = defineProps({
type: String,
required: true,
},
project: {
type: String,
required: true,
},
description: {
type: String,
default: "暫無描述",
Expand Down Expand Up @@ -74,6 +78,8 @@ let props = defineProps({
const {
id,
activity,
project,
description,
name,
date,
startTime,
Expand Down Expand Up @@ -111,16 +117,17 @@ const handleSave = () => {
const start = `2024/03/0${day} ${startTime}`;
const end = `2024/03/0${day} ${endTime}`;
const detail = JSON.stringify({
id,
activity,
name,
date,
start,
end,
host,
location,
link,
saved,
id: id,
name: name,
activity: activity,
project:project,
description: description,
date: date,
startTime: startTime,
endTime: endTime,
host: host,
location: location,
link: link,
});
eventStore.subscribeEvent(id, start, end, detail, name);
};
Expand Down
10 changes: 8 additions & 2 deletions src/components/ScheduleCardModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
<SaveScheduleButton
:id="id"
:activity="activity"
:project="project"
:description="description"
:name="name"
:date="date"
:startTime="startTime"
Expand Down Expand Up @@ -59,7 +61,6 @@
</template>

<script setup>
import { defineProps,defineEmits } from "vue";
import SaveScheduleButton from "./SaveScheduleButton.vue";
const props = defineProps({
id: {
Expand All @@ -78,6 +79,10 @@ const props = defineProps({
type: String,
required: true,
},
project: {
type: String,
required: true,
},
description: {
type: String,
default: "暫無描述",
Expand Down Expand Up @@ -116,7 +121,8 @@ const props = defineProps({
},
});
const { id, link, host, location, date, startTime, endTime, saved } = props;
// const { id, link, host, location, date, startTime, endTime, saved } = props;
const { id, name,activity, project, description, date, startTime, endTime, host, location, link, saved } = props;
defineEmits(["close"]);
</script>
3 changes: 2 additions & 1 deletion src/components/ScheduleCardMultiModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<SaveScheduleButton
:id="event.id"
:activity="event.activity"
:project="event.project"
:description="event.description"
:name="event.name"
:date="event.date"
:startTime="event.startTime"
Expand Down Expand Up @@ -89,7 +91,6 @@
</template>

<script setup>
import { defineProps,defineEmits } from "vue";
import SaveScheduleButton from "./SaveScheduleButton.vue";
const props = defineProps({
Expand Down
25 changes: 10 additions & 15 deletions src/components/ScheduleCardSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<SaveScheduleButton
:id="id"
:activity="activity"
:project="project"
:description="description"
:name="name"
:date="date"
:startTime="startTime"
Expand Down Expand Up @@ -81,6 +83,7 @@
@close="showModal = false"
:id="id"
:activity="activity"
:project="project"
:description="description"
:name="name"
:date="date"
Expand All @@ -96,7 +99,7 @@
</template>

<script setup>
import { defineProps, ref, watch } from "vue";
import { ref } from "vue";
import ScheduleCardModal from "./ScheduleCardModal.vue";
import SaveScheduleButton from "./SaveScheduleButton.vue";
import { useEventStore } from "../stores/user";
Expand All @@ -114,6 +117,10 @@ let props = defineProps({
type: String,
required: true,
},
project: {
type: String,
required: true,
},
description: {
type: String,
default: "暫無描述",
Expand Down Expand Up @@ -157,6 +164,8 @@ let props = defineProps({
const {
id,
activity,
project,
description,
name,
date,
startTime,
Expand All @@ -167,20 +176,6 @@ const {
saved,
} = props;
const handleSave = () => {
// YYYY-MM-DD HH:MM:SS
if (eventStore.isEventSubscribed(id)) {
console.log("unsubscribed");
eventStore.unSubscribeEvent(id, name);
return;
}
const day = date.split("/")[1];
const start = `2024/03/0${day} ${startTime}`;
const end= `2024/03/0${day} ${endTime}`;
const detail = JSON.stringify({ id, activity, name, date, start, end, host, location, link, saved });
eventStore.subscribeEvent(id,start,end, detail,name);
};
const handleCardClick = (e) => {
e.stopPropagation();
if (e.target.tagName === "BUTTON") {
Expand Down
6 changes: 5 additions & 1 deletion src/components/StripCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
<SaveScheduleButton
:id="id"
:activity="activity"
:project="project"
:description="description"
:name="name"
:date="date"
:startTime="startTime"
Expand Down Expand Up @@ -75,6 +77,7 @@
@close="showModal = false"
:id="id"
:activity="activity"
:project="project"
:description="description"
:name="name"
:date="date"
Expand All @@ -90,7 +93,7 @@
</template>

<script setup>
import { defineProps, ref} from "vue";
import { ref} from "vue";
import ScheduleCardModal from "./ScheduleCardModal.vue";
import SaveScheduleButton from "./SaveScheduleButton.vue";
Expand Down Expand Up @@ -160,6 +163,7 @@ const {
id,
activity,
project,
description,
name,
date,
startTime,
Expand Down
1 change: 1 addition & 0 deletions src/views/forum/DepartmentHandbook.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<StripCard
v-for="d in selectedData.related_event_id.map(id => event.find(e => e.id == id))"
:id="d.id"
:activity="d.activity"
:project="d.project"
:description="d.description"
:name="d.name"
Expand Down

0 comments on commit 655cce1

Please sign in to comment.