Whatever ClearWindow needs to be in json
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 42s
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 42s
This commit is contained in:
89
frontend/app/components/windows/EditProfileWindow.vue
Normal file
89
frontend/app/components/windows/EditProfileWindow.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { SetupHandle, SetSize, ResetPosition } from '@/services/Windows';
|
||||
|
||||
import Server from '@/services/Server'
|
||||
import { SetMinSize, SetResizable } from '@/services/Windows';
|
||||
import { backendUrl } from '@/services/BackendURL';
|
||||
import { GetUser } from '@/services/User';
|
||||
|
||||
import WindowHandle from './partials/WindowHandle.vue';
|
||||
import BigIconTemplate from './partials/BigIconTemplate.vue';
|
||||
import FixedBottomButtons from './partials/FixedBottomButtons.vue';
|
||||
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
const userIcon = ref("");
|
||||
|
||||
const handle = ref(null);
|
||||
const isAdmin = ref(false);
|
||||
|
||||
let id = data.id;
|
||||
console.log(data);
|
||||
|
||||
onMounted(() => {
|
||||
SetupHandle(id, handle);
|
||||
SetSize(id, {width: 500, height: 480});
|
||||
ResetPosition(id, "center");
|
||||
|
||||
SetResizable(id, true);
|
||||
SetMinSize(id, {width: 350, height: 280});
|
||||
|
||||
isAdmin.value = GetUser().admin;
|
||||
|
||||
Server().get('/user/retrieve-avatar?username=' + data.user.username).then((response) => {
|
||||
if(response.data.image) userIcon.value = backendUrl + "public/" + response.data.image;
|
||||
else userIcon.value = "public/img/def-avatar.jpg";
|
||||
}).catch((err) => console.log("Internal error"));
|
||||
});
|
||||
|
||||
function RemoveUser(){
|
||||
alert("Remove")
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<div class="window-wrapper" :id="'window-wrapper-' + id">
|
||||
<WindowHandle :window="id" ref="handle"></WindowHandle>
|
||||
|
||||
<BigIconTemplate :title="data.user.username" :img="userIcon">
|
||||
<div v-if="props.data.editable || isAdmin">
|
||||
|
||||
</div>
|
||||
<div v-else>
|
||||
|
||||
</div>
|
||||
</BigIconTemplate>
|
||||
|
||||
<FixedBottomButtons v-if="isAdmin" :remove="RemoveUser"></FixedBottomButtons>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
.window-wrapper {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.splash-image {
|
||||
width: 600px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
align-items: left;
|
||||
flex-direction: column;
|
||||
justify-content: left;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
label {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -9,9 +9,7 @@ const handle = ref(null);
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
|
||||
let id = data.type;
|
||||
|
||||
const test = ref(null)
|
||||
let id = data.id;
|
||||
|
||||
onMounted(() => {
|
||||
SetupHandle(id, handle);
|
||||
|
||||
@@ -21,7 +21,7 @@ const handle = ref(null);
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
|
||||
let id = data.type;
|
||||
let id = data.id;
|
||||
|
||||
const username = ref("");
|
||||
const password = ref("");
|
||||
|
||||
@@ -11,9 +11,7 @@ const handle = ref(null);
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
|
||||
let id = data.type;
|
||||
|
||||
const test = ref(null)
|
||||
let id = data.id;
|
||||
|
||||
onMounted(() => {
|
||||
SetupHandle(id, handle);
|
||||
|
||||
@@ -13,8 +13,7 @@ const handle = ref(null);
|
||||
const props = defineProps(['data']);
|
||||
const data = props.data;
|
||||
|
||||
let id = data.type;
|
||||
|
||||
let id = data.id;
|
||||
|
||||
const username = ref("");
|
||||
const password = ref("");
|
||||
|
||||
31
frontend/app/components/windows/partials/BigIconTemplate.vue
Normal file
31
frontend/app/components/windows/partials/BigIconTemplate.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
const props = defineProps(['title', 'img']);
|
||||
|
||||
const imgSrc = ref("");
|
||||
|
||||
onMounted(() => {
|
||||
imgSrc.value = props.img;
|
||||
watch(() => props.img, () => {
|
||||
imgSrc.value = props.img;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="document centered">
|
||||
<h1>{{props.title}}</h1>
|
||||
<img :src="imgSrc" class="big-icon">
|
||||
<br>
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.big-icon {
|
||||
height: 80px;
|
||||
width: 80px;
|
||||
border: 1px solid var(--color-border);
|
||||
margin:auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,29 @@
|
||||
<script setup>
|
||||
import IconButton from '~/components/partials/IconButton.vue';
|
||||
|
||||
const props = defineProps(['plus', 'edit', 'view', 'remove']);
|
||||
|
||||
let plus = props.plus;
|
||||
let edit = props.edit;
|
||||
let view = props.view;
|
||||
let remove = props.remove;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="fixed-bottom-buttons">
|
||||
<IconButton v-show="plus" icon="/icons/iconoir/regular/plus.svg" :action="plus"></IconButton>
|
||||
<IconButton v-show="edit" icon="/icons/iconoir/regular/edit-pencil.svg" :action="edit"></IconButton>
|
||||
<IconButton v-show="view" icon="/icons/iconoir/solid/eye.svg" :action="view"></IconButton>
|
||||
<IconButton v-show="remove" icon="/icons/iconoir/solid/trash.svg" :action="remove"></IconButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.fixed-bottom-buttons {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
z-index: 2;
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { GetWindowWithId, ClearWindow, Windows } from '@/services/Windows';
|
||||
import { GetWindowWithId } from '@/services/Windows';
|
||||
|
||||
import ArrowLeftIcon from '/icons/iconoir/regular/arrow-left.svg';
|
||||
import XMarkIcon from '/icons/iconoir/regular/xmark.svg';
|
||||
|
||||
Reference in New Issue
Block a user