Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Friends frontend #2995

Merged
merged 5 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions apps/app-frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import AppSettingsModal from '@/components/ui/modal/AppSettingsModal.vue'
import dayjs from 'dayjs'
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
import { hide_ads_window, show_ads_window } from '@/helpers/ads.js'
import FriendsList from '@/components/ui/friends/FriendsList.vue'

const themeStore = useTheming()

Expand Down Expand Up @@ -255,7 +256,7 @@ watch(
hasPlus,
() => {
if (hasPlus.value) {
hide_ads_window()
hide_ads_window(true)
} else {
show_ads_window()
}
Expand Down Expand Up @@ -428,13 +429,19 @@ async function checkUpdates() {
>
<ModrinthLoadingIndicator />
</div>
<div v-if="themeStore.featureFlag_pagePath" class="absolute bottom-0 left-0 m-2 bg-tooltip-bg text-tooltip-text font-semibold rounded-full px-2 py-1 text-xs z-50">
<div
v-if="themeStore.featureFlag_pagePath"
class="absolute bottom-0 left-0 m-2 bg-tooltip-bg text-tooltip-text font-semibold rounded-full px-2 py-1 text-xs z-50"
>
{{ route.fullPath }}
</div>
<div
id="background-teleport-target" class="absolute h-full -z-10 rounded-tl-[--radius-xl] overflow-hidden" :style="{
width: 'calc(100% - var(--right-bar-width))',
}"></div>
id="background-teleport-target"
class="absolute h-full -z-10 rounded-tl-[--radius-xl] overflow-hidden"
:style="{
width: 'calc(100% - var(--right-bar-width))',
}"
></div>
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Suspense @pending="loading.startLoading()" @resolve="loading.stopLoading()">
Expand All @@ -460,12 +467,9 @@ async function checkUpdates() {
</suspense>
</div>
<div class="p-4 border-0 border-b-[1px] border-[--brand-gradient-border] border-solid">
<h3 class="text-lg m-0">Friends</h3>
<p class="m-0">
You have no friends :c. <br />
<br />
<span>Sign in</span> to add friends!
</p>
<suspense>
<FriendsList :credentials="credentials" :sign-in="() => signIn()" />
</suspense>
</div>
<div class="pt-4 flex flex-col">
<h3 class="px-4 text-lg m-0">News</h3>
Expand Down
53 changes: 53 additions & 0 deletions apps/app-frontend/src/components/ui/InstanceIndicator.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<script setup lang="ts">
import { convertFileSrc } from '@tauri-apps/api/core'
import { formatCategory } from '@modrinth/utils'
import { GameIcon, LeftArrowIcon } from '@modrinth/assets'
import { Avatar, ButtonStyled } from '@modrinth/ui'

type Instance = {
game_version: string
loader: string
path: string
install_stage: string
icon_path?: string
name: string
}

defineProps<{
instance: Instance
}>()
</script>

<template>
<div class="flex justify-between items-center border-0 border-b border-solid border-divider pb-4">
<router-link
:to="`/instance/${encodeURIComponent(instance.path)}`"
tabindex="-1"
class="flex flex-col gap-4 text-primary"
>
<span class="flex items-center gap-2">
<Avatar
:src="instance.icon_path ? convertFileSrc(instance.icon_path) : undefined"
:alt="instance.name"
size="48px"
/>
<span class="flex flex-col gap-2">
<span class="font-extrabold bold text-contrast">
{{ instance.name }}
</span>
<span class="text-secondary flex items-center gap-2 font-semibold">
<GameIcon class="h-5 w-5 text-secondary" />
{{ formatCategory(instance.loader) }} {{ instance.game_version }}
</span>
</span>
</span>
</router-link>
<ButtonStyled>
<router-link :to="`/instance/${encodeURIComponent(instance.path)}`">
<LeftArrowIcon /> Back to instance
</router-link>
</ButtonStyled>
</div>
</template>

<style scoped lang="scss"></style>
7 changes: 2 additions & 5 deletions apps/app-frontend/src/components/ui/NavTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
import type { RouteLocationRaw } from 'vue-router';
import type { RouteLocationRaw } from 'vue-router'
import { useRoute, RouterLink } from 'vue-router'

const route = useRoute()
Expand Down Expand Up @@ -69,13 +69,10 @@ function pickLink() {
for (let i = filteredLinks.value.length - 1; i >= 0; i--) {
const link = filteredLinks.value[i]


if (route.path === (typeof link.href === 'string' ? link.href : link.href.path)) {
index = i
break
} else if (
(link.subpages && link.subpages.some((subpage) => route.path.includes(subpage)))
) {
} else if (link.subpages && link.subpages.some((subpage) => route.path.includes(subpage))) {
index = i
subpageSelected.value = true
break
Expand Down
Loading
Loading