Skip to content

Commit

Permalink
chore: images now on cdn, logo reworked
Browse files Browse the repository at this point in the history
  • Loading branch information
hmbanan666 committed Aug 30, 2024
1 parent 46212fe commit 2ef781e
Show file tree
Hide file tree
Showing 117 changed files with 87 additions and 1,553 deletions.
3 changes: 3 additions & 0 deletions .env.example → apps/website/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ NUXT_SESSION_PASSWORD=""
# WebSocket server with event messages
NUXT_PUBLIC_WEBSOCKET_URL="ws://localhost:4200/api/websocket"

# CDN or S3 bucket
NUXT_PUBLIC_CDN_URL=""

# Database
DATABASE_URL=""

Expand Down
93 changes: 38 additions & 55 deletions apps/website/app/components/MainLogo.vue
Original file line number Diff line number Diff line change
@@ -1,88 +1,71 @@
<template>
<ClientOnly>
<div v-if="$route.path === localePath('/')" class="logo" :style="{ backgroundImage: randomCharUrl }" />
<NuxtLink v-else :to="localePath('/')">
<div class="logo shake" :style="{ backgroundImage: randomCharUrl }" />
<div v-if="$route.path === localePath('/')" class="logo">
<img :src="randomCharImage" alt="" class="static-index">
</div>
<NuxtLink v-else :to="localePath('/')" class="logo">
<img :src="randomCharImage" alt="" class="static">
<img :src="randomCharAnimatedImage" alt="" class="animated">
</NuxtLink>
</ClientOnly>
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const characters = [
'shape',
'gentleman',
'banana',
'burger',
'catchy',
'claw',
'marshmallow',
'sharky',
'twitchy',
'wooly',
'woody',
'pup',
]
const randomChar = characters[Math.floor(Math.random() * characters.length)]
const randomCharUrl = `url(/units/${randomChar}/128.png)`
const randomCharImage = `${publicEnv.cdnUrl}/units/${randomChar}/128.png`
const randomCharAnimatedImage = `${publicEnv.cdnUrl}/units/${randomChar}/idle.gif`
</script>

<style scoped>
header {
padding: 0.5em 1em;
display: flex;
justify-content: space-between;
justify-items: center;
align-items: center;
.logo {
width: 64px;
height: 64px;
margin-top: -22px;
transition: all 0.2s;
scale: 1.2;
@media (max-width: 768px) {
& {
padding: 0.5em 0.5em;
}
.static-index {
display: block;
width: 64px;
height: 64px;
}
}
.left {
flex-grow: 1;
flex-basis: 0;
display: flex;
align-items: center;
a {
font-size: 0;
.static {
display: block;
width: 64px;
height: 64px;
}
}
@keyframes skewRandom {
0% {
transform: skewX(0);
}
50% {
transform: skewX(-3deg);
}
75% {
transform: skewX(3deg);
.animated {
display: none;
width: 64px;
height: 64px;
}
100% {
transform: skewX(0);
}
}
.logo {
width: 64px;
height: 64px;
margin-top: -14px;
transition: all 0.2s;
background-size: contain;
scale: 1.2;
&:hover {
scale: 1.3;
&:hover.shake {
animation-name: skewRandom;
animation-duration: 0.5s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
animation-direction: alternate-reverse;
transform-origin: 50% 50%;
scale: 1.1;
.static {
display: none;
}
.animated {
display: block;
}
}
}
</style>
5 changes: 4 additions & 1 deletion apps/website/app/components/MenuProfile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="profile-avatar"
@click="handleMenuClick"
>
<img :src="user?.imageUrl ?? '/icons/twitch/112.png'" alt="">
<img :src="user?.imageUrl ?? defaultImage" alt="">
</button>
<a v-else class="twitch" href="/api/auth/twitch">Войти</a>
</div>
Expand All @@ -14,10 +14,13 @@
<script setup lang="ts">
const { isFeedOpened } = useApp()
const { loggedIn, user } = useUserSession()
const { public: publicEnv } = useRuntimeConfig()
function handleMenuClick() {
isFeedOpened.value = !isFeedOpened.value
}
const defaultImage = `${publicEnv.cdnUrl}/icons/twitch/112.png`
</script>

<style scoped>
Expand Down
5 changes: 3 additions & 2 deletions apps/website/app/pages/character/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</h2>

<div class="unit-avatar">
<img :src="`/units/${character?.codename}/idle.gif`" alt="" class="game-canvas" width="256" height="256">
<img :src="`${publicEnv.cdnUrl}/units/${character?.codename}/idle.gif`" alt="" class="game-canvas" width="256" height="256">
</div>
</section>

Expand Down Expand Up @@ -146,7 +146,7 @@
</p>

<div v-for="post in posts" :key="post.id" class="post">
<img src="/units/twitchy/128.png" alt="" class="avatar">
<img :src="`${publicEnv.cdnUrl}/units/twitchy/128.png`" alt="" class="avatar">
<div class="content">
<div class="info">
<div class="desc">
Expand Down Expand Up @@ -184,6 +184,7 @@ definePageMeta({
},
})
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const route = useRoute()
const { data: character } = await useFetch(`/api/character/${route.params.id}`)
Expand Down
5 changes: 3 additions & 2 deletions apps/website/app/pages/character/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
class="cell"
>
<NuxtLink :to="localePath(`/character/${char.id}`)">
<img :src="`/units/${char.codename}/128.png`" alt="" class="avatar static">
<img :src="`/units/${char.codename}/idle.gif`" alt="" class="avatar animated">
<img :src="`${publicEnv.cdnUrl}/units/${char.codename}/128.png`" alt="" class="avatar static">
<img :src="`${publicEnv.cdnUrl}/units/${char.codename}/idle.gif`" alt="" class="avatar animated">
<p class="nickname">
{{ char.nickname }}
</p>
Expand Down Expand Up @@ -77,6 +77,7 @@
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const { loggedIn, user } = useUserSession()
const { data: profile } = await useFetch(`/api/profile/userName/${user.value?.userName}`)
Expand Down
3 changes: 2 additions & 1 deletion apps/website/app/pages/coupon/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="block">
<div v-for="coupon in coupons" :key="coupon.id" class="card">
<div>
<img src="/units/twitchy/128.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/units/twitchy/128.png`" alt="" width="64" height="64">
<div class="coupon">
<img src="~/assets/img/icons/coupon/64.png" alt="" width="32" height="32">
</div>
Expand Down Expand Up @@ -77,6 +77,7 @@
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const { data: coupons } = await useFetch('/api/coupon/latest')
Expand Down
9 changes: 5 additions & 4 deletions apps/website/app/pages/p/[username].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<h2>Профиль игрока <span class="profile-lvl">{{ pageProfile?.level }} уровня</span></h2>

<div class="unit-avatar">
<img :src="`/units/${activeCharacter?.character.codename}/idle.gif`" alt="" class="game-canvas" width="256" height="256">
<img :src="`${publicEnv.cdnUrl}/units/${activeCharacter?.character.codename}/idle.gif`" alt="" class="game-canvas" width="256" height="256">
</div>

<div class="active-character">
Expand Down Expand Up @@ -112,8 +112,8 @@
<div class="collection-block">
<div v-for="char in pageProfile?.characterEditions" :key="char.id" class="cell" :class="{ active: char.id === activeCharacter?.id }">
<NuxtLink :to="localePath(`/character/${char.character.id}`)">
<img :src="`/units/${char.character.codename}/128.png`" alt="" class="avatar static">
<img :src="`/units/${char.character.codename}/idle.gif`" alt="" class="avatar animated">
<img :src="`${publicEnv.cdnUrl}/units/${char.character.codename}/128.png`" alt="" class="avatar static">
<img :src="`${publicEnv.cdnUrl}/units/${char.character.codename}/idle.gif`" alt="" class="avatar animated">
<p class="nickname">
{{ char.character.nickname }}
</p>
Expand All @@ -135,7 +135,7 @@
<div class="collection-block">
<div v-for="trophyEdition in trophies" :key="trophyEdition.id" class="cell" :data-rarity="trophyEdition.trophy.rarity">
<NuxtLink :to="localePath(`/trophy/${trophyEdition.trophy.id}`)">
<img src="/trophies/default/64.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="64" height="64">
<div class="name">
{{ trophyEdition.trophy.name }}
</div>
Expand Down Expand Up @@ -177,6 +177,7 @@ definePageMeta({
},
})
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const route = useRoute()
const { data: pageProfile } = await useFetch(`/api/profile/userName/${route.params.username}`)
Expand Down
5 changes: 3 additions & 2 deletions apps/website/app/pages/quest/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<p>Награда:</p>
<div class="rewards">
<div class="reward">
<img src="/trophies/default/64.png" alt="" width="28" height="28">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="28" height="28">
Трофей
</div>
</div>
Expand Down Expand Up @@ -52,7 +52,7 @@
<div class="block">
<div v-for="edition in quest?.editions" :key="edition.id" class="card">
<div>
<img src="/units/twitchy/128.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/units/twitchy/128.png`" alt="" width="64" height="64">
</div>
<div>
<NuxtLink :to="localePath(`/p/${edition.profile.userName}`)">
Expand All @@ -75,6 +75,7 @@ definePageMeta({
},
})
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const route = useRoute()
const { data: quest } = await useFetch(`/api/quest/${route.params.id}`)
Expand Down
3 changes: 2 additions & 1 deletion apps/website/app/pages/quest/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<p>Награда:</p>
<div class="rewards">
<div class="reward">
<img src="/trophies/default/64.png" alt="" width="28" height="28">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="28" height="28">
Трофей
</div>
</div>
Expand All @@ -34,6 +34,7 @@
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const { user } = useUserSession()
const { data: questsForProfile } = await useFetch(`/api/quest/profileId/${user.value?.id}`)
Expand Down
6 changes: 5 additions & 1 deletion apps/website/app/pages/shop/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
</div>

<div class="gentleman">
<img src="/units/gentleman/idle.gif" alt="" width="98" height="98">
<img :src="`${publicEnv.cdnUrl}/units/gentleman/idle.gif`" alt="" width="98" height="98">
<div>Уникальный персонаж: Джентельмен</div>
</div>

Expand All @@ -164,6 +164,10 @@
</section>
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
</script>

<style scoped>
.shop {
max-width: 56em;
Expand Down
5 changes: 3 additions & 2 deletions apps/website/app/pages/trophy/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
<div class="completion">
<div class="trophy">
<img src="/trophies/default/64.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="64" height="64">
</div>
<div>
<p class="points">
Expand All @@ -40,7 +40,7 @@
<div class="block">
<div v-for="progress in latestProfiles" :key="progress.id" class="card">
<div>
<img src="/units/twitchy/128.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/units/twitchy/128.png`" alt="" width="64" height="64">
</div>
<div>
<NuxtLink :to="localePath(`/p/${progress.profile.userName}`)">
Expand All @@ -61,6 +61,7 @@ definePageMeta({
},
})
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const route = useRoute()
const { data: trophy } = await useFetch(`/api/trophy/${route.params.id}`)
Expand Down
5 changes: 3 additions & 2 deletions apps/website/app/pages/trophy/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="trophies">
<div v-for="trophy in readyTrophies" :key="trophy.id" class="cell" :data-rarity="trophy.rarity">
<NuxtLink :to="localePath(`/trophy/${trophy.id}`)">
<img src="/trophies/default/64.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="64" height="64">
<div class="name">
{{ trophy.name }}
</div>
Expand All @@ -32,7 +32,7 @@
<div class="trophies">
<div v-for="trophy in inWorkTrophies" :key="trophy.id" class="cell" :data-rarity="trophy.rarity">
<NuxtLink :to="localePath(`/trophy/${trophy.id}`)">
<img src="/trophies/default/64.png" alt="" width="64" height="64">
<img :src="`${publicEnv.cdnUrl}/trophies/default/64.png`" alt="" width="64" height="64">
<div class="name">
{{ trophy.name }}
</div>
Expand All @@ -46,6 +46,7 @@
</template>

<script setup lang="ts">
const { public: publicEnv } = useRuntimeConfig()
const localePath = useLocalePath()
const { data: trophies } = await useFetch('/api/trophy/')
const readyTrophies = trophies.value?.filter((t) => t.isReady)
Expand Down
1 change: 1 addition & 0 deletions apps/website/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default defineNuxtConfig({
public: {
signInRedirectUrl: '', // NUXT_PUBLIC_SIGN_IN_REDIRECT_URL
websocketUrl: '', // NUXT_PUBLIC_WEBSOCKET_URL
cdnUrl: '', // NUXT_PUBLIC_CDN_URL
},
},
i18n: {
Expand Down
Binary file removed apps/website/public/icons/twitch/112.png
Binary file not shown.
Binary file removed apps/website/public/icons/twitch/28.png
Binary file not shown.
Binary file removed apps/website/public/icons/twitch/56.png
Binary file not shown.
Binary file removed apps/website/public/trophies/default/16.png
Binary file not shown.
Binary file removed apps/website/public/trophies/default/32.png
Binary file not shown.
Binary file removed apps/website/public/trophies/default/64.png
Binary file not shown.
Binary file removed apps/website/public/units/banana/128.png
Binary file not shown.
Binary file removed apps/website/public/units/banana/idle.aseprite
Binary file not shown.
Binary file removed apps/website/public/units/banana/idle.gif
Binary file not shown.
Loading

0 comments on commit 2ef781e

Please sign in to comment.