You've already forked AstralRinth
forked from didirus/AstralRinth
* launcher base gui initial * Bootstraps router, Omorphia, and prettier. * Adds pages. Adds Vuex. SideBar nav contains user section and pages section. * Adds Instance markup. Instances added to Home page. * Adds News to home page. * Adds settings to nav. Other touches. * Polishing initial base GUI. * Moves some styling to assets. Changes px values to rem. * Removes pointless border-radius CSS. * Implements Omorphia vars. * Adds trending mods section. * Updates home page. * Swaps Vuex implementation for Pinia. * Fixes invalid CSS on instance list item hover. * Adds @ path resolve for imports. * First pass on search page. * Fix some styling of row display * Cleaning up styles and markup. * Fixes overall layout issues. * Cleans up more styling. Modifies AppBar coloring. * Allows pagination arrows to conditionally appear in RowDisplay. * Adds paging behavior in RowDisplay. * Updates nav and settings button styling. * Brings in Knossos style for trending mods. Polishes News CSS. * Updates Omorphia. Starts addressing PR comments. * Addresses some more PR comments. * Changes side navigation styling. Active route class implemented. * Combines trending and popular row. * Makes images more realistic. Adds CTA to instances. * Converts all instances to card style. Converts more styles to rem. * Moves Navigation and UserSection into App.vue * Adds Modrinth favicon. * Cleans up branch after merge. * Removes unused styling. * Adds transition to news card. * Adds ofetch. Separates stores. More logic moved to instance store. Browse hits API. * Modifies Browse instance styling. Moves Browse results out of Instance.vue. * First pass on filtering. * Points search at prod API. * Updates Omorphia package. Adds index sorting. * Fills out search functionality. * Renames state files. Moves SearchPanel into Browse. Fixes checkbox styling. * Changes how facets are composed. Dynamically sets loaders and categories. * Moves search state to searchStore. Cleans up some code. * Ups h2 font-size. Wraps search panel in Card. * Cleans up branch after merge. Fixes some Browse styling. * Search store produces query string. API call made in Browse. * Changes filter-panel styling. * Uses client and server icons directly. Removes dead code from search store. * Clear button disabled on initial state. Accesses store directly, removes some dead code. Fixes search panel styling. * Generates proj tags in Browse. Removes getter in search store. * Removes unnecessary code. * Reworks facet management. Fixes some styling. * Relabels Tauri calls in tags.js. Attempts to call helper in Browse. * fixed win10 stack overflow * cargo fmt * Makes computed value. Gets tags from Tauri. Overrides Omorphia style. Fixes dropdown width. --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: CodexAdrian <83074853+CodexAdrian@users.noreply.github.com> Co-authored-by: Wyatt Verchere <wverchere@gmail.com>
188 lines
4.3 KiB
Vue
188 lines
4.3 KiB
Vue
<script setup>
|
|
import { ChevronLeftIcon, ChevronRightIcon } from 'omorphia'
|
|
import Instance from '@/components/ui/Instance.vue'
|
|
import News from '@/components/ui/News.vue'
|
|
import { onMounted, onUnmounted, ref } from 'vue'
|
|
|
|
const props = defineProps({
|
|
instances: {
|
|
type: Array,
|
|
default() {
|
|
return []
|
|
},
|
|
},
|
|
news: {
|
|
type: Array,
|
|
default() {
|
|
return []
|
|
},
|
|
},
|
|
label: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
canPaginate: Boolean,
|
|
})
|
|
const allowPagination = ref(false)
|
|
const modsRow = ref(null)
|
|
const newsRow = ref(null)
|
|
// Remove after state is populated with real data
|
|
const shouldRenderNormalInstances = props.instances && props.instances?.length !== 0
|
|
const shouldRenderNews = props.news && props.news?.length !== 0
|
|
const handlePaginationDisplay = () => {
|
|
let parentsRow
|
|
if (shouldRenderNormalInstances) parentsRow = modsRow.value
|
|
if (shouldRenderNews) parentsRow = newsRow.value
|
|
if (!parentsRow) return
|
|
const children = parentsRow.children
|
|
const lastChild = children[children.length - 1]
|
|
const childBox = lastChild.getBoundingClientRect()
|
|
if (childBox.x + childBox.width > window.innerWidth) allowPagination.value = true
|
|
else allowPagination.value = false
|
|
}
|
|
onMounted(() => {
|
|
if (props.canPaginate) window.addEventListener('resize', handlePaginationDisplay)
|
|
// Check if pagination should be rendered on mount
|
|
handlePaginationDisplay()
|
|
})
|
|
onUnmounted(() => {
|
|
if (props.canPaginate) window.removeEventListener('resize', handlePaginationDisplay)
|
|
})
|
|
const handleLeftPage = () => {
|
|
if (shouldRenderNormalInstances) modsRow.value.scrollLeft -= 170
|
|
else if (shouldRenderNews) newsRow.value.scrollLeft -= 170
|
|
}
|
|
const handleRightPage = () => {
|
|
if (shouldRenderNormalInstances) modsRow.value.scrollLeft += 170
|
|
else if (shouldRenderNews) newsRow.value.scrollLeft += 170
|
|
}
|
|
</script>
|
|
<template>
|
|
<div class="row">
|
|
<div class="header">
|
|
<p>{{ props.label }}</p>
|
|
<hr aria-hidden="true" />
|
|
<div v-if="allowPagination" class="pagination">
|
|
<ChevronLeftIcon role="button" @click="handleLeftPage" />
|
|
<ChevronRightIcon role="button" @click="handleRightPage" />
|
|
</div>
|
|
</div>
|
|
<section v-if="shouldRenderNormalInstances" ref="modsRow" class="instances">
|
|
<Instance
|
|
v-for="instance in props.instances"
|
|
:key="instance.id"
|
|
display="card"
|
|
:instance="instance"
|
|
class="row-instance"
|
|
/>
|
|
</section>
|
|
<section v-else-if="shouldRenderNews" ref="newsRow" class="news">
|
|
<News v-for="actualNews in props.news" :key="actualNews.id" :news="actualNews" />
|
|
</section>
|
|
</div>
|
|
</template>
|
|
<style lang="scss" scoped>
|
|
.row {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
width: 100%;
|
|
padding: 1rem;
|
|
|
|
&:nth-child(even) {
|
|
background: var(--color-bg);
|
|
}
|
|
|
|
.header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: inherit;
|
|
width: 100%;
|
|
margin-bottom: 1rem;
|
|
gap: 1rem;
|
|
|
|
p {
|
|
font-size: 1rem;
|
|
white-space: nowrap;
|
|
color: var(--color-contrast);
|
|
}
|
|
|
|
hr {
|
|
background-color: var(--color-gray);
|
|
height: 1px;
|
|
width: 100%;
|
|
border: none;
|
|
}
|
|
|
|
.pagination {
|
|
display: inherit;
|
|
align-items: inherit;
|
|
|
|
svg {
|
|
background: var(--color-raised-bg);
|
|
border-radius: var(--radius-lg);
|
|
width: 1.3rem;
|
|
height: 1.2rem;
|
|
cursor: pointer;
|
|
margin-right: 0.5rem;
|
|
transition: all ease-in-out 0.1s;
|
|
|
|
&:hover {
|
|
filter: brightness(150%);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
section {
|
|
display: flex;
|
|
align-items: inherit;
|
|
transition: all ease-in-out 0.4s;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.news {
|
|
margin: auto;
|
|
width: 100%;
|
|
scroll-behavior: smooth;
|
|
overflow-x: scroll;
|
|
overflow-y: hidden;
|
|
|
|
&::-webkit-scrollbar {
|
|
width: 0px;
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
.instances {
|
|
display: flex;
|
|
flex-direction: row;
|
|
width: 100%;
|
|
gap: 1rem;
|
|
margin-right: auto;
|
|
margin-top: 0.8rem;
|
|
scroll-behavior: smooth;
|
|
overflow-x: scroll;
|
|
overflow-y: hidden;
|
|
|
|
&::-webkit-scrollbar {
|
|
width: 0px;
|
|
background: transparent;
|
|
}
|
|
}
|
|
}
|
|
|
|
.dark-mode {
|
|
.row {
|
|
&:nth-child(odd) {
|
|
background-color: rgb(30, 31, 34);
|
|
}
|
|
}
|
|
}
|
|
|
|
.row-instance {
|
|
min-width: 12rem;
|
|
max-width: 12rem;
|
|
}
|
|
</style>
|