Compare commits

...

5 commits

Author SHA1 Message Date
4da2ede58a
feat: change grouped messages being called compact to grouped
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-05-31 14:50:44 +02:00
3c65a700ff
fix: fetching from malformed endpoints, again 2025-05-31 14:46:01 +02:00
aa710e0a4d
feat: rename some occurrences of guild back to server 2025-05-31 14:38:49 +02:00
4eeb3a8c2a
fix: fetching from malformed endpoints 2025-05-31 14:31:32 +02:00
fe1474416f
feat: change all occurrences of server with guild 2025-05-31 14:27:37 +02:00
6 changed files with 18 additions and 16 deletions

View file

@ -20,7 +20,7 @@ const route = useRoute();
async function generateInvite(): Promise<void> { async function generateInvite(): Promise<void> {
const createdInvite: InviteResponse | undefined = await fetchWithApi( const createdInvite: InviteResponse | undefined = await fetchWithApi(
`/servers/${route.params.serverId}/invites`, `/guilds/${route.params.serverId}/invites`,
{ method: "POST", body: { custom_id: "oijewfoiewf" } } { method: "POST", body: { custom_id: "oijewfoiewf" } }
); );

View file

@ -18,7 +18,7 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else ref="messageElement" class="message compact-message"> <div v-else ref="messageElement" class="message grouped-message">
<div class="left-column"> <div class="left-column">
<div> <div>
<span :class="{ 'invisible': dateHidden }" class="message-date" :title="date.toString()"> <span :class="{ 'invisible': dateHidden }" class="message-date" :title="date.toString()">
@ -42,7 +42,7 @@ const props = defineProps<{
text: string, text: string,
timestamp: number, timestamp: number,
format: "12" | "24", format: "12" | "24",
type: "normal" | "compact", type: "normal" | "grouped",
marginBottom: boolean marginBottom: boolean
}>(); }>();

View file

@ -27,12 +27,13 @@ import scrollToBottom from '~/utils/scrollToBottom';
const props = defineProps<{ channelUrl: string, amount?: number, offset?: number }>(); const props = defineProps<{ channelUrl: string, amount?: number, offset?: number }>();
const messageTimestamps = ref<Record<string, number>>({}); const messageTimestamps = ref<Record<string, number>>({});
const messagesType = ref<Record<string, "normal" | "compact">>({}); const messagesType = ref<Record<string, "normal" | "grouped">>({});
const messagesRes: MessageResponse[] | undefined = await fetchWithApi( const messagesRes: MessageResponse[] | undefined = await fetchWithApi(
`${props.channelUrl}/messages`, `${props.channelUrl}/messages`,
{ query: { "amount": props.amount ?? 100, "offset": props.offset ?? 0 } } { query: { "amount": props.amount ?? 100, "offset": props.offset ?? 0 } }
); );
if (messagesRes) { if (messagesRes) {
messagesRes.reverse(); messagesRes.reverse();
console.log("messages res:", messagesRes.map(msg => msg.message)); console.log("messages res:", messagesRes.map(msg => msg.message));
@ -77,7 +78,7 @@ if (messagesRes) {
continue; continue;
} }
console.log("RETURNING " + lessThanMax.toString().toUpperCase()); console.log("RETURNING " + lessThanMax.toString().toUpperCase());
messagesType.value[message.uuid] = "compact"; messagesType.value[message.uuid] = "grouped";
} }
} }

View file

@ -11,7 +11,7 @@
<Icon name="lucide:house" class="white" size="2rem" /> <Icon name="lucide:house" class="white" size="2rem" />
</NuxtLink> </NuxtLink>
<div id="servers-list"> <div id="servers-list">
<NuxtLink v-for="server of servers" :href="`/servers/${server.uuid}`"> <NuxtLink v-for="guild of guilds" :href="`/servers/${guild.uuid}`">
<Icon name="lucide:server" class="white" size="2rem" /> <Icon name="lucide:server" class="white" size="2rem" />
</NuxtLink> </NuxtLink>
</div> </div>
@ -26,7 +26,7 @@ import type { GuildResponse } from '~/types/interfaces';
const loading = useState("loading", () => false); const loading = useState("loading", () => false);
const servers: GuildResponse[] | undefined = await fetchWithApi("/me/guilds"); const guilds: GuildResponse[] | undefined = await fetchWithApi("/me/guilds");
//const servers = await fetchWithApi("/servers") as { uuid: string, name: string, description: string }[]; //const servers = await fetchWithApi("/servers") as { uuid: string, name: string, description: string }[];
//console.log("servers:", servers); //console.log("servers:", servers);

View file

@ -5,7 +5,7 @@
<h3> <h3>
{{ server?.name }} {{ server?.name }}
<span> <span>
<button @click="showServerSettings"> <button @click="showGuildSettings">
<Icon name="lucide:settings" /> <Icon name="lucide:settings" />
</button> </button>
</span> </span>
@ -20,7 +20,7 @@
<div id="channels-list"> <div id="channels-list">
<Channel v-for="channel of channels" :name="channel.name" <Channel v-for="channel of channels" :name="channel.name"
:uuid="channel.uuid" :current-uuid="(route.params.channelId as string)" :uuid="channel.uuid" :current-uuid="(route.params.channelId as string)"
:href="`/guilds/${route.params.serverId}/channels/${channel.uuid}`" /> :href="`/servers/${route.params.serverId}/channels/${channel.uuid}`" />
</div> </div>
</div> </div>
<MessageArea :channel-url="channelUrlPath" /> <MessageArea :channel-url="channelUrlPath" />
@ -40,7 +40,7 @@ const route = useRoute();
const loading = useState("loading"); const loading = useState("loading");
const channelUrlPath = `/channels/${route.params.channelId}`; const channelUrlPath = `channels/${route.params.channelId}`;
const server = ref<GuildResponse | undefined>(); const server = ref<GuildResponse | undefined>();
const channels = ref<ChannelResponse[] | undefined>(); const channels = ref<ChannelResponse[] | undefined>();
@ -102,18 +102,19 @@ const members = [
onMounted(async () => { onMounted(async () => {
console.log("channelid: set loading to true"); console.log("channelid: set loading to true");
server.value = await fetchWithApi(`servers/${route.params.serverId}`); const guildUrl = `guilds/${route.params.serverId}`;
server.value = await fetchWithApi(guildUrl);
channels.value = await fetchWithApi(`/channels`); channels.value = await fetchWithApi(`${guildUrl}/channels`);
console.log("channels:", channels.value); console.log("channels:", channels.value);
channel.value = await fetchWithApi(route.path); channel.value = await fetchWithApi(`/channels/${route.params.channelId}`);
console.log("channel:", channel.value); console.log("channel:", channel.value);
console.log("channelid: channel:", channel); console.log("channelid: channel:", channel);
console.log("channelid: set loading to false"); console.log("channelid: set loading to false");
}); });
function showServerSettings() { } function showGuildSettings() { }
function toggleInvitePopup(e: Event) { function toggleInvitePopup(e: Event) {
e.preventDefault(); e.preventDefault();

View file

@ -5,8 +5,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
const server = await fetchWithApi(`/guilds/${useRoute().params.serverId}`); const guild = await fetchWithApi(`/guilds/${useRoute().params.serverId}`);
console.log("server:", server); console.log("guild:", guild);
</script> </script>