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

Wire up homepage & library #83

Merged
merged 49 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
68ec655
Top 10 packs & mods by follows plugged into home page. Modpacks insta…
ZachBaird Apr 13, 2023
5d27b12
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 13, 2023
f1ce0c2
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 13, 2023
fc520af
Only displays row if packs are present. Confirmation modal added. Dis…
ZachBaird Apr 15, 2023
4f09b7d
Fixes attr ordering.
ZachBaird Apr 16, 2023
64bb040
Rewires library page. Adds loader.
ZachBaird Apr 18, 2023
8d25a4e
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 18, 2023
9546abf
Updates kill_by_pid to kill_by_uuid.
ZachBaird Apr 18, 2023
8406d40
Starts loading animation when installing on homepage.
ZachBaird Apr 18, 2023
864b46f
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 20, 2023
b973489
Changes RowDisplay key. Polish.
ZachBaird Apr 20, 2023
f28449d
Removes loader. Fixes InstallConfirmModal.
ZachBaird Apr 21, 2023
5d0d4a3
Merge branch 'master' into wire-up-library
ZachBaird Apr 21, 2023
3a86106
Removes loader. Polishing.
ZachBaird Apr 21, 2023
0f9a6aa
Z-index changes.
ZachBaird Apr 21, 2023
e42c233
Z-index changes.
ZachBaird Apr 21, 2023
e7d9091
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 21, 2023
83516fe
Merge branch 'master' into wire-up-library
ZachBaird Apr 21, 2023
92d5489
Fixes content going off screen.
ZachBaird Apr 21, 2023
f84b375
Combines library and home page branches.
ZachBaird Apr 21, 2023
3e8b6d8
Styling changes.
ZachBaird Apr 22, 2023
2c9cc6f
Filters out projects already installed on the home page.
ZachBaird Apr 22, 2023
4cdf95c
Wires up instance.vue, homepage, and appbar to process API.
ZachBaird Apr 23, 2023
3b7fe94
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 24, 2023
46bc068
Cleans up process handling. App bar partially hooked up.
ZachBaird Apr 25, 2023
809bbae
Removes scoped in Settings to fix AnimatedLogo. Adds loader to Instance.
ZachBaird Apr 26, 2023
a8b9ccf
Moves ctas outside of card.
ZachBaird Apr 26, 2023
6eb40aa
Adds mouse over to Stop btn.
ZachBaird Apr 27, 2023
34fb1cf
Removes unnecessary code. Fixes uuid reset.
ZachBaird Apr 27, 2023
c490a3f
Wires up Instance.vue to process API.
ZachBaird Apr 27, 2023
8c922d7
Merges master into branch.
ZachBaird Apr 27, 2023
25b1cf7
Merge branch 'master' into wire-up-homepage
ZachBaird Apr 29, 2023
0af8244
Removes appbar mod count. Updates code to use new linked_data and upd…
ZachBaird Apr 29, 2023
c7c6f4a
Switches load_listener to profile_listener. Unlistens on unmount.
ZachBaird May 3, 2023
5d4f4e8
Merge branch 'master' into wire-up-homepage
ZachBaird May 5, 2023
d10f0f1
Cleans up instance card styling.
ZachBaird May 6, 2023
f8b63c3
Merges master.
ZachBaird May 6, 2023
5e708ff
Fixes margin with uncollapsed navbar. Ensures RowDisplay has data.
ZachBaird May 8, 2023
7aee988
Merge branch 'master' into wire-up-homepage
ZachBaird May 8, 2023
c2fc768
Updates profile_listener. Increases stack size.
ZachBaird May 8, 2023
8970e03
Provides more margin when navbar is expanded.
ZachBaird May 9, 2023
25737f1
fix proper
Geometrically May 9, 2023
919f4cc
Merges master into branch.
ZachBaird May 9, 2023
0835a74
Merge branch 'wire-up-homepage' of https://github.com/modrinth/theseu…
ZachBaird May 9, 2023
cae2ac0
Re-adds calculated width and height. Fixes navbar.
ZachBaird May 9, 2023
7162c0c
Increases stack size further. Navbar is not absolute. View width made…
ZachBaird May 9, 2023
fd1892b
Merge branch 'master' into wire-up-homepage
ZachBaird May 9, 2023
b6638ed
Ensures the specific isntance for a killed process is set to off.
ZachBaird May 9, 2023
593186c
fix menu when not logged in
Geometrically May 9, 2023
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
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Windows has stack overflows when calling from Tauri, so we increase compiler size
[target.'cfg(windows)']
rustflags = ["-C", "link-args=/STACK:8388608"]
rustflags = ["-C", "link-args=/STACK:16777220"]
27 changes: 10 additions & 17 deletions theseus_gui/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<script setup>
import { ref, onMounted } from 'vue'
import { onMounted } from 'vue'
import { RouterView, RouterLink } from 'vue-router'
import { HomeIcon, SearchIcon, LibraryIcon, PlusIcon, SettingsIcon, Button } from 'omorphia'
import { useTheming } from '@/store/state'
import AccountsCard from '@/components/ui/AccountsCard.vue'
import InstanceCreationModal from '@/components/ui/InstanceCreationModal.vue'
import { list } from '@/helpers/profile'
import { get } from '@/helpers/settings'
import Breadcrumbs from '@/components/ui/Breadcrumbs.vue'
import RunningAppBar from '@/components/ui/RunningAppBar.vue'
Expand All @@ -17,16 +16,6 @@ onMounted(async () => {
themeStore.setThemeState(settings)
themeStore.collapsedNavigation = collapsed_navigation
})

const installedMods = ref(0)
list().then(
(profiles) =>
(installedMods.value = Object.values(profiles).reduce(
(acc, val) => acc + Object.keys(val.projects).length,
0
))
)
// TODO: add event when profiles update to update installed mods count
</script>

<template>
Expand Down Expand Up @@ -117,9 +106,13 @@ list().then(
</section>
</div>
<div class="router-view">
<Suspense>
<RouterView />
</Suspense>
<RouterView v-slot="{ Component }">
<template v-if="Component">
<Suspense>
<component :is="Component"></component>
</Suspense>
</template>
</RouterView>
</div>
</div>
</div>
Expand All @@ -133,10 +126,10 @@ list().then(
overflow: hidden;

.view {
width: calc(100% - 5rem);
width: var(--view-width);

&.expanded {
width: calc(100% - 12rem);
width: var(--expanded-view-width);
}

.appbar {
Expand Down
2 changes: 2 additions & 0 deletions theseus_gui/src/assets/stylesheets/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
:root {
font-family: var(--font-standard);
color-scheme: dark;
--view-width: calc(100% - 5rem);
--expanded-view-width: calc(100% - 13rem);
}

* {
Expand Down
28 changes: 20 additions & 8 deletions theseus_gui/src/components/RowDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,34 @@ const props = defineProps({
},
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

// This is wrapped in a setTimeout because the HtmlCollection seems to struggle
// with getting populated sometimes. It's a flaky error, but providing a bit of
// wait-time for the below expressions has not failed thus-far.
setTimeout(() => {
const children = parentsRow.children
const lastChild = children[children.length - 1]
const childBox = lastChild?.getBoundingClientRect()

if (childBox?.x + childBox?.width > window.innerWidth && props.canPaginate)
allowPagination.value = true
else allowPagination.value = false
}, 300)
}

onMounted(() => {
if (props.canPaginate) window.addEventListener('resize', handlePaginationDisplay)
// Check if pagination should be rendered on mount
Expand All @@ -48,6 +59,7 @@ onMounted(() => {
onUnmounted(() => {
if (props.canPaginate) window.removeEventListener('resize', handlePaginationDisplay)
})

const handleLeftPage = () => {
if (shouldRenderNormalInstances) modsRow.value.scrollLeft -= 170
else if (shouldRenderNews) newsRow.value.scrollLeft -= 170
Expand All @@ -58,7 +70,7 @@ const handleRightPage = () => {
}
</script>
<template>
<div class="row">
<div v-if="props.instances.length > 0" class="row">
<div class="header">
<p>{{ props.label }}</p>
<hr aria-hidden="true" />
Expand All @@ -70,7 +82,7 @@ const handleRightPage = () => {
<section v-if="shouldRenderNormalInstances" ref="modsRow" class="instances">
<Instance
v-for="instance in props.instances"
:key="instance.id"
:key="instance?.project_id || instance?.id"
display="card"
:instance="instance"
class="row-instance"
Expand Down
2 changes: 1 addition & 1 deletion theseus_gui/src/components/ui/AccountsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Avatar :size="expanded ? 'xs' : 'sm'" :src="selectedAccount?.profile_picture ?? ''" />
<div v-show="expanded" class="avatar-text">
<div class="text no-select">
{{ selectedAccount.username }}
{{ selectedAccount ? selectedAccount.username : 'Offline' }}
</div>
<p class="no-select">
<UsersIcon />
Expand Down
Loading