File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @devprotocol/huddle01-clubs-plugin" ,
3- "version" : " 0.1.6 " ,
3+ "version" : " 0.1.7 " ,
44 "type" : " module" ,
55 "description" : " Repository for using Clubs-Huddle01 Plugin" ,
66 "main" : " dist/index.js" ,
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ import { computed } from ' vue'
3+ import { toCompactISOTimeFromISO } from ' ../../fixtures'
4+
5+ const props = defineProps <{
6+ redirectToUrl: (calendarLink : string | undefined ) => void
7+ meetingLink: string | undefined
8+ roomType: string
9+ startTime: string | undefined
10+ expiryTime: string | undefined
11+ description: string | undefined
12+ }>()
13+
14+ const compactStartTime = computed (() => {
15+ return toCompactISOTimeFromISO (props .startTime as string )
16+ })
17+ const compactExpiryTime = computed (() => {
18+ return toCompactISOTimeFromISO (props .expiryTime as string )
19+ })
20+
21+ const timeZone = new Intl .DateTimeFormat (' en-US' , {
22+ timeZoneName: ' short' ,
23+ }).resolvedOptions ().timeZone
24+
25+ console .log (' starttime' , props .startTime )
26+ const calendarLink = computed (() => {
27+ return ` https://calendar.google.com/calendar/r/eventedit?action=TEMPLATE&dates=${compactStartTime .value }%2F${compactExpiryTime .value }&text=${encodeURIComponent (props .description ? props .description : ' ' )}&details=${encodeURIComponent (props .description ? props .description : ' ' )}&location=${encodeURIComponent (props .meetingLink ? props .meetingLink : ' ' )}&stz=${timeZone }&etz=${timeZone } `
28+ })
29+ </script >
30+ <template >
31+ <button
32+ class =" is-fullwidth w-full gap-4 font-bold border border-black rounded-full text-black hover:bg-[#D9D9D9]"
33+ @click ="
34+ () => {
35+ redirectToUrl(calendarLink)
36+ }
37+ "
38+ >
39+ Add to Calendar 🗓️
40+ </button >
41+ </template >
Original file line number Diff line number Diff line change 22import { ref , onMounted , computed } from ' vue'
33import { currentPost } from ' @devprotocol/clubs-plugin-posts/plugin-helper'
44import Join from ' ./Meeting/Join.vue'
5+ import AddToCal from ' ./Meeting/AddToCal.vue'
56import type { Posts } from ' @devprotocol/clubs-plugin-posts'
67import type { Meet } from ' ../types.ts'
78import { connection } from ' @devprotocol/clubs-core/connection'
@@ -51,6 +52,15 @@ const redirectToUrl = (url: string | undefined) => {
5152 :roomType =" currentMeet .roomType "
5253 :startTime =" currentMeet .startTime "
5354 :expiryTime =" currentMeet .expiryTime "
55+ class="mb-4"
56+ />
57+ <AddToCal
58+ :redirectToUrl =" redirectToUrl "
59+ :meetingLink =" currentMeet .meetingLink "
60+ :roomType =" currentMeet .roomType "
61+ :startTime =" currentMeet .startTime "
62+ :expiryTime =" currentMeet .expiryTime "
63+ :description =" currentMeet .description "
5464 />
5565 </section >
5666 </div >
Original file line number Diff line number Diff line change @@ -29,6 +29,21 @@ export const formatISOTimestamp = (isoTimestamp: string) => {
2929 return `${ hours } :${ minutes } ${ amPm } (${ day } :${ month } :${ year } ) ${ timeZone } `
3030}
3131
32+ export const toCompactISOTimeFromISO = ( isoTimestamp : string ) => {
33+ const date = new Date ( isoTimestamp )
34+ const pad = ( number : number ) => number . toString ( ) . padStart ( 2 , '0' )
35+
36+ // Extract components
37+ const year = date . getUTCFullYear ( )
38+ const month = pad ( date . getUTCMonth ( ) + 1 ) // Months are zero-indexed
39+ const day = pad ( date . getUTCDate ( ) )
40+ const hours = pad ( date . getUTCHours ( ) )
41+ const minutes = pad ( date . getUTCMinutes ( ) )
42+ const seconds = pad ( date . getUTCSeconds ( ) )
43+
44+ return `${ year } ${ month } ${ day } T${ hours } ${ minutes } ${ seconds } Z`
45+ }
46+
3247export const isFutureTimestamp = ( isoTimestamp : string ) => {
3348 if ( isoTimestamp === undefined ) {
3449 return true
You can’t perform that action at this time.
0 commit comments