You've already forked AstralRinth
forked from didirus/AstralRinth
More app fixes 0.9.0 (#3054)
* initial set of fixes (toggle sidebar, profile pagination) * more fixes, bump version * fix lint: * fix quick switcher ordering
This commit is contained in:
@@ -22,7 +22,11 @@
|
||||
"parameters": {
|
||||
"Right": 1
|
||||
},
|
||||
"nullable": [false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "1397c1825096fb402cdd3b5dae8cd3910b1719f433a0c34d40415dd7681ab272"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "18881c0c2ec1b0cc73fa13b4c242dfc577061b92479ce96ffb30a457939b5ffe"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "265f9c9ad992da0aeaf69c3f0077b54a186b98796ec549c9d891089ea33cf3fc"
|
||||
}
|
||||
|
||||
@@ -32,7 +32,13 @@
|
||||
"parameters": {
|
||||
"Right": 3
|
||||
},
|
||||
"nullable": [false, false, null, true, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
true,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "28b3e3132d75e551c1fa14b8d3be36adca581f8ad1b90f85d3ec3d92ec61e65e"
|
||||
}
|
||||
|
||||
@@ -27,7 +27,12 @@
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "6d7ebc0f233dc730fa8c99c750421065f5e35f321954a9d5ae9cde907d5ce823"
|
||||
}
|
||||
|
||||
@@ -41,13 +41,22 @@
|
||||
{
|
||||
"name": "display_claims!: serde_json::Value",
|
||||
"ordinal": 7,
|
||||
"type_info": "Text"
|
||||
"type_info": "Null"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false, false, false, false, null]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "6e3fa492c085ebb8e7280dd4d55cdcf73da199ea6ac05ee3ee798ece80d877cf"
|
||||
}
|
||||
|
||||
@@ -37,7 +37,14 @@
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "727e3e1bc8625bbcb833920059bb8cea926ac6c65d613904eff1d740df30acda"
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n UPDATE settings\n SET\n max_concurrent_writes = $1,\n max_concurrent_downloads = $2,\n\n theme = $3,\n default_page = $4,\n collapsed_navigation = $5,\n advanced_rendering = $6,\n native_decorations = $7,\n\n discord_rpc = $8,\n developer_mode = $9,\n telemetry = $10,\n personalized_ads = $11,\n\n onboarded = $12,\n\n extra_launch_args = jsonb($13),\n custom_env_vars = jsonb($14),\n mc_memory_max = $15,\n mc_force_fullscreen = $16,\n mc_game_resolution_x = $17,\n mc_game_resolution_y = $18,\n hide_on_process_start = $19,\n\n hook_pre_launch = $20,\n hook_wrapper = $21,\n hook_post_exit = $22,\n\n custom_dir = $23,\n prev_custom_dir = $24,\n migrated = $25\n ",
|
||||
"query": "\n UPDATE settings\n SET\n max_concurrent_writes = $1,\n max_concurrent_downloads = $2,\n\n theme = $3,\n default_page = $4,\n collapsed_navigation = $5,\n advanced_rendering = $6,\n native_decorations = $7,\n\n discord_rpc = $8,\n developer_mode = $9,\n telemetry = $10,\n personalized_ads = $11,\n\n onboarded = $12,\n\n extra_launch_args = jsonb($13),\n custom_env_vars = jsonb($14),\n mc_memory_max = $15,\n mc_force_fullscreen = $16,\n mc_game_resolution_x = $17,\n mc_game_resolution_y = $18,\n hide_on_process_start = $19,\n\n hook_pre_launch = $20,\n hook_wrapper = $21,\n hook_post_exit = $22,\n\n custom_dir = $23,\n prev_custom_dir = $24,\n migrated = $25,\n\n toggle_sidebar = $26,\n feature_flags = $27\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Right": 25
|
||||
"Right": 27
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "26e3ed8680f6c492b03b458aabfb3f94fddc753b343ef705263188945d0e578d"
|
||||
"hash": "759e4ffe30ebc4f8602256cb419ef15732d84bcebb9ca15225dbabdc0f46ba2d"
|
||||
}
|
||||
@@ -37,7 +37,14 @@
|
||||
"parameters": {
|
||||
"Right": 0
|
||||
},
|
||||
"nullable": [false, false, false, false, false, false]
|
||||
"nullable": [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "bf7d47350092d87c478009adaab131168e87bb37aa65c2156ad2cb6198426d8c"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"db_name": "SQLite",
|
||||
"query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, default_page, collapsed_navigation, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry, personalized_ads,\n onboarded,\n json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,\n mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,\n hook_pre_launch, hook_wrapper, hook_post_exit,\n custom_dir, prev_custom_dir, migrated\n FROM settings\n ",
|
||||
"query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, default_page, collapsed_navigation, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry, personalized_ads,\n onboarded,\n json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,\n mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,\n hook_pre_launch, hook_wrapper, hook_post_exit,\n custom_dir, prev_custom_dir, migrated, json(feature_flags) feature_flags, toggle_sidebar\n FROM settings\n ",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
@@ -127,6 +127,16 @@
|
||||
"name": "migrated",
|
||||
"ordinal": 24,
|
||||
"type_info": "Integer"
|
||||
},
|
||||
{
|
||||
"name": "feature_flags",
|
||||
"ordinal": 25,
|
||||
"type_info": "Text"
|
||||
},
|
||||
{
|
||||
"name": "toggle_sidebar",
|
||||
"ordinal": 26,
|
||||
"type_info": "Integer"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
@@ -157,8 +167,10 @@
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
]
|
||||
},
|
||||
"hash": "8e19c9cdb0aaa48509724e82f6e8f212c9cd2112fdba77cfeee206025af47761"
|
||||
"hash": "d90a2f2f823fc546661a94af07249758c5ca82db396268bca5087bac88f733d9"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "theseus"
|
||||
version = "0.9.0-1"
|
||||
version = "0.9.0-2"
|
||||
authors = ["Jai A <jaiagr+gpg@pm.me>"]
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE settings ADD COLUMN toggle_sidebar INTEGER NOT NULL DEFAULT FALSE;
|
||||
ALTER TABLE settings ADD COLUMN feature_flags JSONB NOT NULL default '{}';
|
||||
@@ -474,7 +474,11 @@ impl CacheValue {
|
||||
| CacheValue::DonationPlatforms(_) => DEFAULT_ID.to_string(),
|
||||
|
||||
CacheValue::FileHash(hash) => {
|
||||
format!("{}-{}", hash.size, hash.path.replace(".disabled", ""))
|
||||
format!(
|
||||
"{}-{}",
|
||||
hash.size,
|
||||
hash.path.trim_end_matches(".disabled")
|
||||
)
|
||||
}
|
||||
CacheValue::FileUpdate(hash) => {
|
||||
format!("{}-{}-{}", hash.hash, hash.loader, hash.game_version)
|
||||
|
||||
@@ -122,10 +122,12 @@ impl State {
|
||||
|
||||
#[tracing::instrument]
|
||||
async fn initialize_state() -> crate::Result<Arc<Self>> {
|
||||
tracing::info!("Connecting to app database");
|
||||
let pool = db::connect().await?;
|
||||
|
||||
legacy_converter::migrate_legacy_data(&pool).await?;
|
||||
|
||||
tracing::info!("Fetching app settings");
|
||||
let mut settings = Settings::get(&pool).await?;
|
||||
|
||||
let fetch_semaphore =
|
||||
@@ -135,6 +137,7 @@ impl State {
|
||||
let api_semaphore =
|
||||
FetchSemaphore(Semaphore::new(settings.max_concurrent_downloads));
|
||||
|
||||
tracing::info!("Initializing directories");
|
||||
DirectoryInfo::move_launcher_directory(
|
||||
&mut settings,
|
||||
&pool,
|
||||
@@ -145,6 +148,7 @@ impl State {
|
||||
|
||||
let discord_rpc = DiscordGuard::init()?;
|
||||
|
||||
tracing::info!("Initializing file watcher");
|
||||
let file_watcher = fs_watcher::init_watcher().await?;
|
||||
fs_watcher::watch_profiles_init(&file_watcher, &directories).await;
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ impl Profile {
|
||||
path: format!(
|
||||
"{}/{folder}/{}",
|
||||
self.path,
|
||||
file_name.replace(".disabled", "")
|
||||
file_name.trim_end_matches(".disabled")
|
||||
),
|
||||
file_name: file_name.to_string(),
|
||||
project_type,
|
||||
@@ -725,8 +725,9 @@ impl Profile {
|
||||
let info_index = file_info.iter().position(|x| x.hash == hash.hash);
|
||||
let file = info_index.map(|x| file_info.remove(x));
|
||||
|
||||
if let Some(initial_file_index) =
|
||||
keys.iter().position(|x| x.path == hash.path)
|
||||
if let Some(initial_file_index) = keys
|
||||
.iter()
|
||||
.position(|x| x.path == hash.path.trim_end_matches(".disabled"))
|
||||
{
|
||||
let initial_file = keys.remove(initial_file_index);
|
||||
|
||||
@@ -890,7 +891,7 @@ impl Profile {
|
||||
let path = crate::api::profile::get_full_path(profile_path).await?;
|
||||
|
||||
let new_path = if project_path.ends_with(".disabled") {
|
||||
project_path.replace(".disabled", "")
|
||||
project_path.trim_end_matches(".disabled").to_string()
|
||||
} else {
|
||||
format!("{project_path}.disabled")
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//! Theseus settings file
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
||||
// Types
|
||||
/// Global Theseus settings
|
||||
@@ -13,10 +15,10 @@ pub struct Settings {
|
||||
pub collapsed_navigation: bool,
|
||||
pub advanced_rendering: bool,
|
||||
pub native_decorations: bool,
|
||||
pub toggle_sidebar: bool,
|
||||
|
||||
pub telemetry: bool,
|
||||
pub discord_rpc: bool,
|
||||
pub developer_mode: bool,
|
||||
pub personalized_ads: bool,
|
||||
|
||||
pub onboarded: bool,
|
||||
@@ -32,6 +34,16 @@ pub struct Settings {
|
||||
pub custom_dir: Option<String>,
|
||||
pub prev_custom_dir: Option<String>,
|
||||
pub migrated: bool,
|
||||
|
||||
pub developer_mode: bool,
|
||||
pub feature_flags: HashMap<FeatureFlag, bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Copy, Eq, Hash, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum FeatureFlag {
|
||||
PagePath,
|
||||
ProjectBackground,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
@@ -48,7 +60,7 @@ impl Settings {
|
||||
json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,
|
||||
mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,
|
||||
hook_pre_launch, hook_wrapper, hook_post_exit,
|
||||
custom_dir, prev_custom_dir, migrated
|
||||
custom_dir, prev_custom_dir, migrated, json(feature_flags) feature_flags, toggle_sidebar
|
||||
FROM settings
|
||||
"
|
||||
)
|
||||
@@ -63,6 +75,7 @@ impl Settings {
|
||||
collapsed_navigation: res.collapsed_navigation == 1,
|
||||
advanced_rendering: res.advanced_rendering == 1,
|
||||
native_decorations: res.native_decorations == 1,
|
||||
toggle_sidebar: res.toggle_sidebar == 1,
|
||||
telemetry: res.telemetry == 1,
|
||||
discord_rpc: res.discord_rpc == 1,
|
||||
developer_mode: res.developer_mode == 1,
|
||||
@@ -95,6 +108,11 @@ impl Settings {
|
||||
custom_dir: res.custom_dir,
|
||||
prev_custom_dir: res.prev_custom_dir,
|
||||
migrated: res.migrated == 1,
|
||||
feature_flags: res
|
||||
.feature_flags
|
||||
.as_ref()
|
||||
.and_then(|x| serde_json::from_str(x).ok())
|
||||
.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -108,6 +126,7 @@ impl Settings {
|
||||
let default_page = self.default_page.as_str();
|
||||
let extra_launch_args = serde_json::to_string(&self.extra_launch_args)?;
|
||||
let custom_env_vars = serde_json::to_string(&self.custom_env_vars)?;
|
||||
let feature_flags = serde_json::to_string(&self.feature_flags)?;
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
@@ -143,7 +162,10 @@ impl Settings {
|
||||
|
||||
custom_dir = $23,
|
||||
prev_custom_dir = $24,
|
||||
migrated = $25
|
||||
migrated = $25,
|
||||
|
||||
toggle_sidebar = $26,
|
||||
feature_flags = $27
|
||||
",
|
||||
max_concurrent_writes,
|
||||
max_concurrent_downloads,
|
||||
@@ -169,7 +191,9 @@ impl Settings {
|
||||
self.hooks.post_exit,
|
||||
self.custom_dir,
|
||||
self.prev_custom_dir,
|
||||
self.migrated
|
||||
self.migrated,
|
||||
self.toggle_sidebar,
|
||||
feature_flags
|
||||
)
|
||||
.execute(exec)
|
||||
.await?;
|
||||
@@ -185,6 +209,7 @@ pub enum Theme {
|
||||
Dark,
|
||||
Light,
|
||||
Oled,
|
||||
System,
|
||||
}
|
||||
|
||||
impl Theme {
|
||||
@@ -193,6 +218,7 @@ impl Theme {
|
||||
Theme::Dark => "dark",
|
||||
Theme::Light => "light",
|
||||
Theme::Oled => "oled",
|
||||
Theme::System => "system",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +227,7 @@ impl Theme {
|
||||
"dark" => Theme::Dark,
|
||||
"light" => Theme::Light,
|
||||
"oled" => Theme::Oled,
|
||||
"system" => Theme::System,
|
||||
_ => Theme::Dark,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
ref="dropdown"
|
||||
no-auto-focus
|
||||
:aria-id="dropdownId || null"
|
||||
placement="bottom-end"
|
||||
@apply-hide="focusTrigger"
|
||||
@apply-show="focusMenuChild"
|
||||
>
|
||||
|
||||
@@ -5,7 +5,6 @@ import Checkbox from '../base/Checkbox.vue'
|
||||
import ContentListItem from './ContentListItem.vue'
|
||||
import type { ContentItem } from './ContentListItem.vue'
|
||||
import { DropdownIcon } from '@modrinth/assets'
|
||||
import { createVirtualScroller } from 'vue-typed-virtual-list'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -13,12 +12,11 @@ const props = withDefaults(
|
||||
sortColumn: string
|
||||
sortAscending: boolean
|
||||
updateSort: (column: string) => void
|
||||
currentPage: number
|
||||
}>(),
|
||||
{},
|
||||
)
|
||||
|
||||
const VirtualScroller = createVirtualScroller()
|
||||
|
||||
const selectionStates: Ref<Record<string, boolean>> = ref({})
|
||||
const selected: Ref<string[]> = computed(() =>
|
||||
Object.keys(selectionStates.value).filter(
|
||||
@@ -42,6 +40,10 @@ function setSelected(value: boolean) {
|
||||
}
|
||||
updateSelection()
|
||||
}
|
||||
|
||||
const paginatedItems = computed(() =>
|
||||
props.items.slice((props.currentPage - 1) * 20, props.currentPage * 20),
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -78,21 +80,19 @@ function setSelected(value: boolean) {
|
||||
</slot>
|
||||
</div>
|
||||
<div class="bg-bg-raised rounded-xl">
|
||||
<VirtualScroller :items="items" :default-size="64" style="height: 100%">
|
||||
<template #item="{ ref, index }">
|
||||
<ContentListItem
|
||||
v-model="selectionStates[ref.filename]"
|
||||
:item="ref"
|
||||
:last="index === items.length - 1"
|
||||
class="mb-2"
|
||||
@update:model-value="updateSelection"
|
||||
>
|
||||
<template #actions="{ item }">
|
||||
<slot name="actions" :item="item" />
|
||||
</template>
|
||||
</ContentListItem>
|
||||
<ContentListItem
|
||||
v-for="(itemRef, index) in paginatedItems"
|
||||
:key="itemRef.filename"
|
||||
v-model="selectionStates[itemRef.filename]"
|
||||
:item="itemRef"
|
||||
:last="index === paginatedItems.length - 1"
|
||||
class="mb-2"
|
||||
@update:model-value="updateSelection"
|
||||
>
|
||||
<template #actions="{ item }">
|
||||
<slot name="actions" :item="item" />
|
||||
</template>
|
||||
</VirtualScroller>
|
||||
</ContentListItem>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -26,14 +26,15 @@
|
||||
v-tooltip="
|
||||
`${formatNumber(project.followers, false)} follower${project.downloads !== 1 ? 's' : ''}`
|
||||
"
|
||||
class="flex items-center gap-2 border-0 border-solid border-divider pr-4 md:border-r cursor-help"
|
||||
class="flex items-center gap-2 border-0 border-solid border-divider pr-4 cursor-help"
|
||||
:class="{ 'md:border-r': project.categories.length > 0 }"
|
||||
>
|
||||
<HeartIcon class="h-6 w-6 text-secondary" />
|
||||
<span class="font-semibold">
|
||||
{{ formatNumber(project.followers) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="hidden items-center gap-2 md:flex">
|
||||
<div v-if="project.categories.length > 0" class="hidden items-center gap-2 md:flex">
|
||||
<TagsIcon class="h-6 w-6 text-secondary" />
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<TagItem v-for="(category, index) in project.categories" :key="index">
|
||||
|
||||
Reference in New Issue
Block a user