feat: implement new guild icons
This commit is contained in:
parent
25501147ae
commit
ed38340249
3 changed files with 57 additions and 16 deletions
|
@ -3,8 +3,9 @@
|
||||||
class="display-avatar"
|
class="display-avatar"
|
||||||
:src="displayAvatar"
|
:src="displayAvatar"
|
||||||
:alt="displayName" />
|
:alt="displayName" />
|
||||||
<Icon v-else
|
<DefaultIcon v-else-if="user"
|
||||||
name="lucide:user"
|
:name="displayName"
|
||||||
|
:seed="user.uuid"
|
||||||
:alt="displayName" />
|
:alt="displayName" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -28,10 +29,6 @@ if (user) {
|
||||||
|
|
||||||
if (user.avatar) {
|
if (user.avatar) {
|
||||||
displayAvatar = user.avatar
|
displayAvatar = user.avatar
|
||||||
} else if (!isCanvasBlocked()){
|
|
||||||
displayAvatar = generateDefaultIcon(displayName, user.uuid)
|
|
||||||
} else {
|
|
||||||
displayAvatar = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
45
components/DefaultIcon.vue
Normal file
45
components/DefaultIcon.vue
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<template>
|
||||||
|
<div :style="`background-color: ${generateIrcColor(seed, 50)}`"
|
||||||
|
class="default-icon">
|
||||||
|
<span class="default-icon-text">
|
||||||
|
{{ previewName }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
seed: string,
|
||||||
|
name: string
|
||||||
|
}>();
|
||||||
|
|
||||||
|
let previewName = "";
|
||||||
|
if (props.name.length > 3) {
|
||||||
|
let guildName: string[] = props.name.split(' ')
|
||||||
|
for (let i = 0; i < 3; i ++) {
|
||||||
|
if (guildName.length > i) {
|
||||||
|
previewName += guildName[i].charAt(0)
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
previewName = props.name
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.default-icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.default-icon-text {
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
color: var(--secondary-text-color)
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -17,19 +17,15 @@
|
||||||
</div>
|
</div>
|
||||||
<VerticalSpacer />
|
<VerticalSpacer />
|
||||||
<div class="left-column-segment" id="left-column-middle">
|
<div class="left-column-segment" id="left-column-middle">
|
||||||
<NuxtLink v-for="guild of guilds" :href="`/servers/${guild.uuid}`">
|
<NuxtLink v-for="guild of guilds" :href="`/servers/${guild.uuid}`" id="guild-icon-container">
|
||||||
<NuxtImg v-if="guild.icon"
|
<NuxtImg v-if="guild.icon"
|
||||||
class="sidebar-icon guild-icon"
|
class="sidebar-icon guild-icon"
|
||||||
:alt="guild.name"
|
:alt="guild.name"
|
||||||
:src="guild.icon" />
|
:src="guild.icon" />
|
||||||
<NuxtImg v-else-if="!blockedCanvas"
|
<DefaultIcon
|
||||||
class="sidebar-icon guild-icon"
|
class="sidebar-icon guild-icon"
|
||||||
:alt="guild.name"
|
:alt="guild.name"
|
||||||
:src="generateDefaultIcon(guild.name, guild.uuid)" />
|
:name="guild.name" :seed="guild.uuid"/>
|
||||||
<Icon v-else name="lucide:server"
|
|
||||||
:style="`color: ${generateIrcColor(guild.uuid, 50)}`"
|
|
||||||
class="sidebar-icon guild-icon"
|
|
||||||
:alt="guild.name" />
|
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
<VerticalSpacer />
|
<VerticalSpacer />
|
||||||
|
@ -52,6 +48,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ModalBase } from '#components';
|
import { ModalBase } from '#components';
|
||||||
import { render } from 'vue';
|
import { render } from 'vue';
|
||||||
|
import DefaultIcon from '~/components/DefaultIcon.vue';
|
||||||
import GuildDropdown from '~/components/Guild/GuildDropdown.vue';
|
import GuildDropdown from '~/components/Guild/GuildDropdown.vue';
|
||||||
import Button from '~/components/UserInterface/Button.vue';
|
import Button from '~/components/UserInterface/Button.vue';
|
||||||
import VerticalSpacer from '~/components/UserInterface/VerticalSpacer.vue';
|
import VerticalSpacer from '~/components/UserInterface/VerticalSpacer.vue';
|
||||||
|
@ -63,8 +60,6 @@ const createButtonContainer = ref<HTMLButtonElement>();
|
||||||
|
|
||||||
const api = useApi();
|
const api = useApi();
|
||||||
|
|
||||||
const blockedCanvas = isCanvasBlocked()
|
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{ name: "Join", value: "join", callback: async () => {
|
{ name: "Join", value: "join", callback: async () => {
|
||||||
console.log("join guild!");
|
console.log("join guild!");
|
||||||
|
@ -249,6 +244,10 @@ function createDropdown() {
|
||||||
height: var(--sidebar-icon-width);
|
height: var(--sidebar-icon-width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#guild-icon-container {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.guild-icon {
|
.guild-icon {
|
||||||
border-radius: var(--guild-icon-radius);
|
border-radius: var(--guild-icon-radius);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue