diff --git a/Cargo.lock b/Cargo.lock index a6c704308..740f7f675 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8956,7 +8956,7 @@ dependencies = [ [[package]] name = "theseus" -version = "0.9.0-1" +version = "0.9.0-2" dependencies = [ "async-recursion", "async-tungstenite", @@ -9007,7 +9007,7 @@ dependencies = [ [[package]] name = "theseus_gui" -version = "0.9.0-1" +version = "0.9.0-2" dependencies = [ "chrono", "cocoa 0.25.0", diff --git a/apps/app-frontend/package.json b/apps/app-frontend/package.json index 3f7fe8ed2..ae3969723 100644 --- a/apps/app-frontend/package.json +++ b/apps/app-frontend/package.json @@ -1,7 +1,7 @@ { "name": "@modrinth/app-frontend", "private": true, - "version": "0.9.0-1", + "version": "0.9.0-2", "type": "module", "scripts": { "dev": "vite", diff --git a/apps/app-frontend/src/App.vue b/apps/app-frontend/src/App.vue index 8e79597d8..727d86a28 100644 --- a/apps/app-frontend/src/App.vue +++ b/apps/app-frontend/src/App.vue @@ -15,6 +15,7 @@ import { MaximizeIcon, RestoreIcon, LogOutIcon, + RightArrowIcon, } from '@modrinth/assets' import { Avatar, Button, ButtonStyled, Notifications, OverflowMenu } from '@modrinth/ui' import { useLoading, useTheming } from '@/store/state' @@ -54,40 +55,14 @@ import { get_user } from '@/helpers/cache.js' 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 { hide_ads_window, init_ads_window } from '@/helpers/ads.js' import FriendsList from '@/components/ui/friends/FriendsList.vue' import { openUrl } from '@tauri-apps/plugin-opener' import QuickInstanceSwitcher from '@/components/ui/QuickInstanceSwitcher.vue' const themeStore = useTheming() -const news = ref([ - { - title: 'Introducing Modrinth Servers', - summary: 'Host your next Minecraft server with Modrinth.', - thumbnail: - 'https://media.beehiiv.com/cdn-cgi/image/format=auto,width=800,height=421,fit=scale-down,onerror=redirect/uploads/asset/file/eefddc59-b4c4-4e7d-92e8-c26bdef42984/Modrinth-Servers-Thumb.png', - date: '2024-11-02T00:00:00Z', - link: 'https://blog.modrinth.com/p/modrinth-servers-beta', - }, - { - title: 'Becoming Sustainable', - summary: 'Announcing 5x creator revenue and updates to the monetization program.', - thumbnail: - 'https://media.beehiiv.com/cdn-cgi/image/format=auto,width=800,height=421,fit=scale-down,onerror=redirect/uploads/asset/file/c99b9885-8248-4d7a-b19a-3ae2c902fdd5/revenue.png', - date: '2024-09-13T00:00:00Z', - link: 'https://blog.modrinth.com/p/creator-revenue-update', - }, - { - title: 'Modrinth+ and New Ads', - summary: - 'Introducing a new advertising system, a subscription to remove ads, and a redesign of the website!\n', - thumbnail: - 'https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,format=auto,onerror=redirect,quality=80/uploads/asset/file/38ce85e4-5d93-43eb-b61b-b6296f6b9e66/things.png?t=1724260059', - date: '2024-08-21T00:00:00Z', - link: 'https://blog.modrinth.com/p/introducing-modrinth-refreshed-site-look-new-advertising-system', - }, -]) +const news = ref([]) const urlModal = ref(null) @@ -132,6 +107,9 @@ async function setupApp() { advanced_rendering, onboarded, default_page, + toggle_sidebar, + developer_mode, + feature_flags, } = await get() if (default_page === 'Library') { @@ -149,6 +127,9 @@ async function setupApp() { themeStore.setThemeState(theme) themeStore.collapsedNavigation = collapsed_navigation themeStore.advancedRendering = advanced_rendering + themeStore.toggleSidebar = toggle_sidebar + themeStore.devMode = developer_mode + themeStore.featureFlags = feature_flags isMaximized.value = await getCurrentWindow().isMaximized() @@ -190,6 +171,12 @@ async function setupApp() { } }) + useFetch(`https://modrinth.com/blog/news.json`, 'news', true).then((res) => { + if (res && res.articles) { + news.value = res.articles + } + }) + get_opening_command().then(handleCommand) checkUpdates() fetchCredentials() @@ -263,13 +250,29 @@ const hasPlus = computed( (credentials.value.user.badges & MIDAS_BITFLAG) === MIDAS_BITFLAG, ) +const sidebarToggled = ref(true) + +themeStore.$subscribe(() => { + sidebarToggled.value = !themeStore.toggleSidebar +}) + +const forceSidebar = ref(false) +const sidebarVisible = computed(() => sidebarToggled.value || forceSidebar.value) +const showAd = computed(() => !(!sidebarVisible.value || hasPlus.value)) + +router.afterEach((to) => { + forceSidebar.value = to.path.startsWith('/browse') || to.path.startsWith('/project') +}) + watch( - hasPlus, + showAd, () => { - if (hasPlus.value) { + if (!showAd.value) { hide_ads_window(true) } else { - show_ads_window() + setTimeout(() => { + init_ads_window(true) + }, 400) } }, { immediate: true }, @@ -367,21 +370,21 @@ function handleAuxClick(e) {
- + - - -
- + -
- + - - + - Sign out - +
-
+
-
+
+ + +
@@ -465,7 +481,11 @@ function handleAuxClick(e) {
-
+
{{ route.fullPath }} @@ -507,7 +527,7 @@ function handleAuxClick(e) { :class="{ 'pb-12': !hasPlus }" > -