-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6920bd
commit 09b6859
Showing
15 changed files
with
359 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script setup lang="ts"> | ||
import type { Broadcast } from '@/services/TrackscapeApiTypes' | ||
import { type PropType, ref } from 'vue' | ||
Check warning on line 3 in trackscape-discord-ui/src/components/BroadcastItem.vue
|
||
const props = defineProps({ | ||
broadcast: { | ||
type: Object as PropType<Broadcast>, | ||
required: true | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div class="p-2 shadow-xl bg-base-100"> | ||
<div class="flex items-center gap-x-7"> | ||
<div class="flex items-center"> | ||
<img v-if="props.broadcast.broadcast.icon_url !== null" | ||
class="w-10 h-10 rounded-full object-contain mr-1" | ||
:src="props.broadcast.broadcast.icon_url" | ||
onerror="this.src = '/src/assets/img/Trackscape_Logo_icon.png'" | ||
alt="" | ||
/> | ||
|
||
<div> | ||
<p class="text-md font-bold">{{ props.broadcast.broadcast.title }}</p> | ||
<p class="text-sm text-gray-500">{{ props.broadcast.created_at }}</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-1"> | ||
<p>{{ props.broadcast.broadcast.message }}</p> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<script setup lang="ts"> | ||
import BroadcastItem from '@/components/BroadcastItem.vue' | ||
import { ref } from 'vue' | ||
import type { Broadcast } from '@/services/TrackscapeApiTypes' | ||
import TrackscapeApiClient from '@/services/TrackscapeApiClient' | ||
let broadcasts = ref<Broadcast[]>() | ||
let loading = ref(true) | ||
let props = defineProps({ | ||
clanId: { | ||
type: String, | ||
required: true | ||
}, | ||
limit: { | ||
type: Number, | ||
required: false, | ||
default: 10 | ||
}, | ||
showHeader: { | ||
type: Boolean, | ||
required: false, | ||
default: true | ||
} | ||
}) | ||
let client = new TrackscapeApiClient(import.meta.env.VITE_API_BASE_URL) | ||
client.getBroadcasts(props.clanId, props.limit).then((broadcastsResult) => { | ||
broadcastsResult.forEach((broadcast) => { | ||
broadcast.created_at = new Date(broadcast.created_at).toLocaleString() | ||
broadcast.broadcast.title = broadcast.broadcast.title.replace(/:.*:/, '') | ||
}) | ||
broadcasts.value = broadcastsResult | ||
loading.value = false | ||
}) | ||
</script> | ||
|
||
<template> | ||
<TransitionGroup name="slide-fade"> | ||
|
||
<div v-if="loading"> | ||
<div class="flex items-center gap-x-2"> | ||
</div> | ||
<div class="mt-2"> | ||
<div v-for="index in 10" | ||
:key="index" | ||
class="p-2 shadow-xl bg-base-100"> | ||
<div class="p-2 shadow-xl bg-base-100"> | ||
<div class="flex items-center "> | ||
<div class="flex items-center"> | ||
<div class="skeleton w-10 h-10 rounded-full shrink-0"></div> | ||
<div class="flex flex-col gap-1"> | ||
<div class="skeleton h-6 w-28"></div> | ||
<div class="skeleton h-4 w-28"></div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-1 flex flex-col gap-1"> | ||
<div class="skeleton h-4 w-3/4"></div> | ||
<div class="skeleton h-4 w-3/4"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div v-else> | ||
<div class="flex items-center gap-x-2"> | ||
<div v-if="props.showHeader" | ||
class="flex items-center"> | ||
<div> | ||
<p class="text-lg font-bold">Recent Broadcasts</p> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="mt-2"> | ||
<div v-for="broadcast in broadcasts" | ||
:key="broadcast.id" | ||
class="p-5 shadow-xl bg-base-100"> | ||
<BroadcastItem :broadcast="broadcast" /> | ||
</div> | ||
</div> | ||
</div> | ||
</TransitionGroup> | ||
|
||
|
||
</template> | ||
|
||
<style scoped> | ||
.slide-fade-enter-active { | ||
transition: all 0.1s ease-in; | ||
} | ||
.slide-fade-leave-active { | ||
transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1); | ||
} | ||
.slide-fade-enter-from, | ||
.slide-fade-leave-to { | ||
transform: translateX(-20px); | ||
opacity: 0; | ||
} | ||
</style> |
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.