Compare commits

...
Sign in to create a new pull request.

23 commits

Author SHA1 Message Date
cca2c5ffd9 chore: CI thingy
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-23 21:50:40 +02:00
8102412ef2 chore: commit to make the CI work
the CI server was down during the last commit
2025-06-23 21:46:55 +02:00
6141cac41a Merge branch 'settings-page'
All checks were successful
ci/woodpecker/manual/build-and-publish Pipeline was successful
co-authored-by: JustTemmie <git@beaver.mom>
2025-06-23 21:11:08 +02:00
9fd9fb6744 feat: code polishing
co-authored-by: JustTemmie <git@beaver.mom>
co-authored-by: SauceyRed <saucey@saucey.red>
2025-06-23 20:46:05 +02:00
714f75ce12 feat: update button component
co-authored-by: JustTemmie <git@beaver.mom>
2025-06-23 20:02:09 +02:00
5560680635
feat: use dynamic units, minor refactoring 2025-06-11 17:42:35 +02:00
22b43cde79
feat: make profile settings headings into block labels for accessibility
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2025-06-03 22:04:05 +02:00
a38589615b
chore: finnish merge
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/pr/build-and-publish Pipeline was successful
2025-06-02 13:14:08 +02:00
cb1979a941
Merge branch 'settings-page' of ssh://git.gorb.app:2022/gorb/frontend into settings-page 2025-06-02 13:13:44 +02:00
acc4fa14b7
feat: finish up the my account section for now 2025-06-02 13:10:42 +02:00
8a3bb89f8a
Merge branch 'main' into settings-page 2025-06-02 12:36:20 +02:00
4b1f1266b0
fix: type hinting 2025-06-02 12:36:04 +02:00
a8e8c6b2ef
feat: define expected types for pfp input element
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 20:34:40 +02:00
0ddddd210e
feat: fucking explode i hate this
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 20:19:04 +02:00
622abc9155
feat: profile page, EXCEPT FUCKING AVATARS AAAAAHHH
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 19:24:50 +02:00
256889a573
feat: favicon!! 2025-06-01 17:46:09 +02:00
cb5360c687
Merge branch 'main' into settings-page 2025-06-01 16:38:02 +02:00
a2c04af8ce
feat: basic user popup implemented
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 16:36:59 +02:00
fc266ffcc3
feat: log out button should work?
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 12:20:21 +02:00
162ca6833f feat: change colour of focused settings category
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 07:28:09 +02:00
39fb0a9eab feat: start of "My Account" page, need API help
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 07:15:20 +02:00
705b37fa06 feat: button components
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 06:13:00 +02:00
5012517e9b feat: Fundementals for settings pages
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
2025-06-01 05:04:38 +02:00
15 changed files with 549 additions and 1 deletions

View file

@ -1,5 +1,7 @@
# Nuxt Minimal Starter
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup

44
components/Button.vue Normal file
View file

@ -0,0 +1,44 @@
<template>
<div @click="props.callback()" class="button" :class="props.variant + '-button'">
{{ props.text }}
</div>
</template>
<script lang="ts" setup>
const props = defineProps<{
text: string,
callback: CallableFunction,
variant?: "normal" | "scary" | "neutral",
}>();
</script>
<style scoped>
.button {
cursor: pointer;
background-color: #b35719;
color: #ffffff;
padding: 0.7dvh 1.2dvw;
font-size: 1.1em;
transition: background-color 0.2s;
border-radius: 0.7rem;
text-decoration: none;
display: inline-block;
}
.scary-button {
background-color: red;
}
.neutral-button {
background-color: grey;
}
.button:hover {
background-color: #934410;
}
</style>

View file

@ -0,0 +1,14 @@
<template>
<div>
<h1>hi</h1>
<h5>TEST</h5>
<h5>TEST</h5>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,12 @@
<template>
<div>
<h1>Keybinds (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,12 @@
<template>
<div>
<h1>Language (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,12 @@
<template>
<div>
<h1>Notifications (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,155 @@
<template>
<div>
<h1>My Account</h1>
<div class="profile-container">
<div class="user-data-fields" v-if="user">
<p class="subtitle">AVATAR</p>
<Button text="Change Avatar" :callback="changeAvatar" style="margin-right: 0.8dvw;"></Button>
<Button text="Remove Avatar" :callback="removeAvatar" variant="neutral"></Button>
<label for="profile-display-name-input" class="subtitle">DISPLAY NAME</label>
<input id="profile-display-name-input" class="profile-data-input" type="text" v-model="user.display_name" placeholder="Enter display name" />
<label for="profile-username-input" class="subtitle">USERNAME</label>
<input id="profile-username-input" class="profile-data-input" type="text" v-model="user.username" placeholder="Enter username" />
<label for="profile-pronouns-input" class="subtitle">PRONOUNS</label>
<input id="profile-pronouns-input" class="profile-data-input" type="text" v-model="user.pronouns" placeholder="Enter pronouns" />
<label for="profile-about-me-input" class="subtitle">ABOUT ME</label>
<input id="profile-about-me-input" class="profile-data-input" type="text" v-model="user.about" placeholder="About me" />
<br>
<Button style="margin-top: 1dvh" text="Save Changes" :callback="saveChanges"></Button>
</div>
<UserPopup v-if="user" :user="user" class="profile-popup"></UserPopup>
</div>
<h2 style="margin-top: 8duservh">Password (and eventually authenticator)</h2>
<Button text="Reset Password (tbd)" :callback=resetPassword></Button>
<h2>Account Deletion</h2>
<Button text="Delete Account (tbd)" :callback=deleteAccount variant="scary"></Button>
</div>
</template>
<script lang="ts" setup>
import Button from '~/components/Button.vue';
import type { UserResponse } from '~/types/interfaces';
const { fetchUser } = useAuth();
const user: UserResponse | undefined = await fetchUser()
if (!user) {
alert("could not fetch user info, aborting :(")
}
let newPfpFile: File;
const saveChanges = async () => {
if (!user) return;
const formData = new FormData()
if (newPfpFile) {
formData.append("avatar", newPfpFile)
}
const bytes = new TextEncoder().encode(JSON.stringify({
display_name: user.display_name,
username: user.username,
pronouns: user.pronouns,
about: user.about,
}));
formData.append('json', new Blob([bytes], { type: 'application/json' }));
try {
await fetchWithApi('/me', {
method: 'PATCH',
body: formData
})
alert('success!!')
} catch (error: any) {
if (error?.response?.status !== 200) {
alert(`error ${error?.response?.status} met whilst trying to update profile info`)
}
}
};
const removeAvatar = async () => {
alert("TBD")
// await fetchWithApi(`/auth/reset-password`);
}
const changeAvatar = async () => {
if (!user) return;
const input = document.createElement('input');
input.type = 'file';
input.accept = 'image/*';
input.addEventListener("change", (e: Event) => {
if (input.files?.length && input.files.length > 0) {
const file = input.files[0];
if (!file) return;
newPfpFile = file
const reader = new FileReader();
reader.addEventListener("onload", () => {
if (reader.result && typeof reader.result === 'string') {
user.avatar = reader.result;
}
});
reader.readAsDataURL(file);
}
})
input.click()
}
const resetPassword = async () => {
alert("TBD")
// await fetchWithApi(`/auth/reset-password`);
}
const deleteAccount = async () => {
alert("TBD")
}
</script>
<style scoped>
.profile-container {
display: flex;
}
.subtitle {
display: block;
font-size: 0.8em;
font-weight: 800;
margin: 1.5dvh 0 0.5dvh 0.25dvw;
}
.user-data-fields {
min-width: 35dvw;
max-width: 35dvw;
}
.profile-data-input {
min-width: 30dvw;
margin: 0.07dvh;
padding: 0.1dvh 0.7dvw;
height: 2.5em;
font-size: 1em;
border-radius: 8px;
border: none;
color: white;
background-color: #54361b;
}
.profile-popup {
margin-left: 2dvw;
}
</style>

View file

@ -0,0 +1,12 @@
<template>
<div>
<h1>Connections (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,12 @@
<template>
<div>
<h1>Devices (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
</script>
<style scoped>
</style>

View file

@ -0,0 +1,13 @@
<template>
<div>
<h1>Privacy (TBA)</h1>
</div>
</template>
<script lang="ts" setup>
import Button from '~/components/Button.vue';
</script>
<style scoped>
</style>

85
components/UserPopup.vue Normal file
View file

@ -0,0 +1,85 @@
<template>
<div id="profile-popup">
<img v-if="props.user.avatar" id="avatar" :src="props.user.avatar" alt="profile avatar">
<div id="cover-colour"></div>
<div id="main-body">
<p id="display-name">
<strong>{{ props.user.display_name }}</strong>
</p>
<p id="username-and-pronouns">
{{ props.user.username }}
<span v-if="props.user.pronouns"> - {{ props.user.pronouns }}</span>
</p>
<div id="about-me" v-if="props.user.about">
{{ props.user.about }}
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import type { UserResponse } from '~/types/interfaces';
const { fetchMembers } = useApi();
const props = defineProps<{
user: UserResponse
}>();
</script>
<style scoped>
#profile-popup {
min-width: 300px;
max-width: 300px;
border-radius: 8px;
position: relative;
display: flex;
flex-direction: column;
}
#cover-colour {
border-radius: 12px 12px 0 0;
min-height: 60px;
background-color: #442505;
}
#main-body {
border-radius: 0 0 12px 12px;
padding: 12px;
min-height: 280px;
background-color: #4b3018;
overflow-wrap: break-word;
hyphens: manual;
}
#avatar {
width: 96px;
height: 96px;
border: 5px solid #4b3018;
border-radius: 100%;
position: absolute;
left: 16px;
top: 16px;
}
#display-name {
margin-top: 60px;
margin-bottom: 0;
font-size: 28px;
}
#username-and-pronouns {
margin: 2px;
font-size: 16px;
}
#about-me {
background-color: #34200f;
border-radius: 12px;
margin-top: 32px;
padding: 16px;
font-size: 16px;
}
</style>

View file

@ -75,7 +75,7 @@ export const useAuth = () => {
async function fetchUser() {
if (!accessToken.value) return;
console.log("fetchuser access token:", accessToken.value);
const res = await fetchWithApi("/users/me") as UserResponse;
const res = await fetchWithApi("/me") as UserResponse;
user.value = res;
return user.value;
}
@ -88,6 +88,20 @@ export const useAuth = () => {
return user.value;
}
// as in email the password link
async function resetPassword() {
// ...
}
async function disableAccount() {
// ...
}
async function deleteAccount() {
// ...
}
return {
accessToken,
register,

159
pages/settings.vue Normal file
View file

@ -0,0 +1,159 @@
<template>
<div id="settings-page-container">
<div id="settings-page">
<div id="sidebar">
<h4>(Search bar here)</h4>
<ul>
<div v-for="category in categories" :key="category.displayName">
<h2>{{ category.displayName }}</h2>
<li v-for="page in category.pages" :key="page.displayName" @click="selectCategory(page)"
:class="{ 'sidebar-focus': selectedPage === page.displayName }">
{{ page.displayName }}
</li>
<span class="spacer"></span>
</div>
<Button text="Log Out" :callback=logout variant="scary"></Button>
</ul>
</div>
<div id="sub-page">
<component :is="currentPage.pageData" />
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import Button from '~/components/Button.vue';
const { logout } = useAuth()
interface Page {
displayName: string;
pageData: any; // is actually Component but TS is yelling at me :(
}
interface Category {
displayName: string;
pages: Page[];
}
import Account from '~/components/Settings/UserSettings/Account.vue';
import Privacy from '~/components/Settings/UserSettings/Privacy.vue';
import Devices from '~/components/Settings/UserSettings/Devices.vue';
import Connections from '~/components/Settings/UserSettings/Connections.vue';
import Appearance from '~/components/Settings/AppSettings/Appearance.vue';
import Notifications from '~/components/Settings/AppSettings/Notifications.vue';
import Keybinds from '~/components/Settings/AppSettings/Keybinds.vue';
import Language from '~/components/Settings/AppSettings/Language.vue';
const settingsCategories = {
userSettings: {
displayName: "User Settings",
pages: [
{ displayName: "My Account", pageData: Account },
{ displayName: "Privacy", pageData: Privacy },
{ displayName: "Devices", pageData: Devices },
{ displayName: "Connections", pageData: Connections },
]
},
appSettings: {
displayName: "App Settings",
pages: [
{ displayName: "Appearance", pageData: Appearance },
{ displayName: "Notifications", pageData: Notifications },
{ displayName: "Keybinds", pageData: Keybinds },
{ displayName: "Language", pageData: Language },
]
},
};
const categories = Object.values(settingsCategories);
let currentPage = ref(categories[0].pages[0]);
let selectedPage = ref(currentPage.value.displayName); // used to highlight the current channel
function selectCategory(page: Page) {
currentPage.value = page;
selectedPage.value = page.displayName;
};
</script>
<style scoped>
#settings-page-container {
height: 100%;
align-content: center;
overflow-y: hidden;
margin: 0;
}
#settings-page {
height: 100vh;
display: flex;
}
#sidebar {
min-width: 25dvw;
max-width: 25dvw;
background-color: #2f3136;
color: white;
padding: 1dvh 1dvw;
margin-left: auto;
overflow-y: auto;
height: 100vh;
}
#sidebar h2 {
font-size: 0.95em;
padding: 0 0.8dvw;
}
#sidebar ul {
list-style-type: none;
padding: 0;
margin: 0;
}
#sidebar li {
border-radius: 8px;
padding: 0.8dvh 0.8dvw;
font-size: 1.4em;
cursor: pointer;
transition: background-color 0.3s;
}
.sidebar-focus {
background-color: #383B41;
}
#sidebar li:hover {
background-color: #40444b;
}
#sub-page {
flex-grow: 1;
min-width: 70dvw;
max-width: 70dvw;
padding-left: 1.5rem;
margin-right: auto;
overflow-y: auto;
height: 100vh;
}
.spacer {
height: 0.2dvh;
display: block;
margin: 0.8dvh 1dvw;
background-color: #2c2e32;
}
/* applies to child pages too */
:deep(h5) {
color: red;
}
</style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Before After
Before After

View file

@ -58,6 +58,8 @@ export interface UserResponse {
username: string,
display_name: string | null,
avatar: string | null,
pronouns: string | null,
about: string | null,
email?: string,
email_verified?: boolean
}