diff --git a/.woodpecker/build-and-publish.yml b/.woodpecker/build-and-publish.yml index e62bd74..6001a00 100644 --- a/.woodpecker/build-and-publish.yml +++ b/.woodpecker/build-and-publish.yml @@ -8,6 +8,7 @@ steps: - pnpm build when: - event: push + - event: pull_request - name: container-build-and-publish image: docker diff --git a/app.vue b/app.vue index 8ca7948..3a1c491 100644 --- a/app.vue +++ b/app.vue @@ -1,7 +1,7 @@ @@ -55,10 +55,7 @@ function contextMenuHandler(e: MouseEvent) { diff --git a/components/Me/AddFriend.vue b/components/Me/AddFriend.vue index 6d2d888..43249fb 100644 --- a/components/Me/AddFriend.vue +++ b/components/Me/AddFriend.vue @@ -23,9 +23,11 @@ async function sendRequest() { try { await addFriend(inputField.value.value) alert("Friend request sent!") - } catch { - alert("Request failed :(") - } + } catch (error: any) { + if (error?.response?.status !== 200) { + alert(`error ${error?.response?.status} met whilst trying to add friend\n"${error?.response._data?.message}"`) + } + } } } diff --git a/components/Me/FriendsList.vue b/components/Me/FriendsList.vue index 0a1481e..25b9924 100644 --- a/components/Me/FriendsList.vue +++ b/components/Me/FriendsList.vue @@ -24,6 +24,8 @@ @@ -42,9 +49,12 @@ onMounted(() => { flex-direction: column; gap: 1em; opacity: 100%; - padding: 1%; - background-color: var(--sidebar-highlighted-background-color); + + padding: var(--standard-radius); + border-radius: var(--standard-radius); + background-color: var(--chat-highlighted-background-color); color: var(--text-color); + overflow: hidden; } diff --git a/components/Modal/ProfilePopup.vue b/components/Modal/ProfilePopup.vue new file mode 100644 index 0000000..07181be --- /dev/null +++ b/components/Modal/ProfilePopup.vue @@ -0,0 +1,243 @@ + + + + + \ No newline at end of file diff --git a/components/Popups/CropPopup.vue b/components/Popups/CropPopup.vue index 3a9586c..12c3a0b 100644 --- a/components/Popups/CropPopup.vue +++ b/components/Popups/CropPopup.vue @@ -10,7 +10,6 @@ @@ -21,11 +22,12 @@ const props = defineProps<{ background-color: var(--primary-color); color: var(--text-color); - padding: 0.4em 0.75em; - font-size: 1.1em; + padding: 0.35em 0.65em; + font-size: 1em; + transition: background-color 0.2s; - border-radius: 0.7rem; + border-radius: var(--standard-radius); text-decoration: none; display: inline-block; @@ -50,4 +52,11 @@ const props = defineProps<{ background-color: var(--accent-highlighted-color); } +.stealth-button { + background-color: unset; +} +.stealth-button:hover { + background-color: unset; +} + \ No newline at end of file diff --git a/components/UserInterface/HorizontalSpacer.vue b/components/UserInterface/HorizontalSpacer.vue new file mode 100644 index 0000000..cc95c92 --- /dev/null +++ b/components/UserInterface/HorizontalSpacer.vue @@ -0,0 +1,12 @@ + + + diff --git a/components/UserInterface/VerticalSpacer.vue b/components/UserInterface/VerticalSpacer.vue index 8ac1bd6..9f0e304 100644 --- a/components/UserInterface/VerticalSpacer.vue +++ b/components/UserInterface/VerticalSpacer.vue @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/types/interfaces.ts b/types/interfaces.ts index 2a05c38..6fd9c96 100644 --- a/types/interfaces.ts +++ b/types/interfaces.ts @@ -96,7 +96,8 @@ export interface ModalProps { title?: string, obscure?: boolean, onClose?: () => void, - onCancel?: () => void + onCancel?: () => void, + onCloseButton?: () => void, } export interface ContextMenuItem { diff --git a/utils/editMessage.ts b/utils/editMessage.ts index 5cc3ce8..d8ad005 100644 --- a/utils/editMessage.ts +++ b/utils/editMessage.ts @@ -1,9 +1,12 @@ import type { MessageProps } from "~/types/props"; +const { fetchMe } = useApi() + export default async (element: HTMLDivElement, props: MessageProps) => { console.log("message:", element); - const me = await fetchWithApi("/me") as any; - if (props.author?.uuid == me.uuid) { + const me = await fetchMe(); + + if (me && props.author?.uuid == me.uuid) { const text = element.getElementsByClassName("message-text")[0] as HTMLDivElement; text.contentEditable = "true"; text.focus(); diff --git a/utils/getDisplayName.ts b/utils/getDisplayName.ts deleted file mode 100644 index 015edbc..0000000 --- a/utils/getDisplayName.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { GuildMemberResponse, UserResponse } from "~/types/interfaces"; - -export default (user: UserResponse, member?: GuildMemberResponse): string => { - if (member?.nickname) return member.nickname - if (user.display_name) return user.display_name - return user.username -} \ No newline at end of file diff --git a/utils/sortMembers.ts b/utils/sortMembers.ts index 87a1a2a..b232763 100644 --- a/utils/sortMembers.ts +++ b/utils/sortMembers.ts @@ -1,7 +1,8 @@ import type { GuildMemberResponse } from "~/types/interfaces"; +const { getDisplayName } = useProfile() export default (members: GuildMemberResponse[]): GuildMemberResponse[] => { return members.sort((a, b) => { - return getDisplayName(a.user, a).localeCompare(getDisplayName(b.user, b)) + return getDisplayName(a).localeCompare(getDisplayName(b)) }) } \ No newline at end of file diff --git a/utils/sortUsers.ts b/utils/sortUsers.ts index 8708366..83f5713 100644 --- a/utils/sortUsers.ts +++ b/utils/sortUsers.ts @@ -1,4 +1,5 @@ import type { UserResponse } from "~/types/interfaces"; +const { getDisplayName } = useProfile() export default (users: UserResponse[]): UserResponse[] => { return users.sort((a, b) => { diff --git a/utils/uuidToDate.ts b/utils/uuidToDate.ts new file mode 100644 index 0000000..f0ab6f3 --- /dev/null +++ b/utils/uuidToDate.ts @@ -0,0 +1,6 @@ +export default (uuid: string): Date => { + const timeHex = uuid.substring(0, 8) + uuid.substring(9, 13); + const timestamp = parseInt(timeHex, 16); + + return new Date(timestamp); +} \ No newline at end of file