diff --git a/.cargo/config.toml b/.cargo/config.toml index 37c78c26b..fa8480ead 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -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"] \ No newline at end of file +rustflags = ["-C", "link-args=/STACK:16777220"] \ No newline at end of file diff --git a/theseus_gui/src/App.vue b/theseus_gui/src/App.vue index 10d82f6f1..278368012 100644 --- a/theseus_gui/src/App.vue +++ b/theseus_gui/src/App.vue @@ -117,9 +117,13 @@ defineExpose({
- - - + + +
@@ -133,10 +137,10 @@ defineExpose({ overflow: hidden; .view { - width: calc(100% - 5rem); + width: var(--view-width); &.expanded { - width: calc(100% - 12rem); + width: var(--expanded-view-width); } .appbar { diff --git a/theseus_gui/src/assets/stylesheets/global.scss b/theseus_gui/src/assets/stylesheets/global.scss index ea8fedef0..0769da7cf 100644 --- a/theseus_gui/src/assets/stylesheets/global.scss +++ b/theseus_gui/src/assets/stylesheets/global.scss @@ -3,6 +3,8 @@ :root { font-family: var(--font-standard); color-scheme: dark; + --view-width: calc(100% - 5rem); + --expanded-view-width: calc(100% - 13rem); } * { diff --git a/theseus_gui/src/components/RowDisplay.vue b/theseus_gui/src/components/RowDisplay.vue index 746473b52..352a10346 100644 --- a/theseus_gui/src/components/RowDisplay.vue +++ b/theseus_gui/src/components/RowDisplay.vue @@ -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 @@ -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 @@ -58,7 +70,7 @@ const handleRightPage = () => { } -