Starts adding search pages to launcher. (#49)

* 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>
This commit is contained in:
Zach Baird
2023-04-05 10:18:04 -04:00
committed by GitHub
parent b0c830119b
commit 8169d3ad49
17 changed files with 915 additions and 281 deletions

View File

@@ -134,13 +134,12 @@ impl Tags {
// Fetches the tags from the Modrinth API and stores them in the database
#[tracing::instrument(skip(self))]
pub async fn fetch_update(&mut self) -> crate::Result<()> {
let categories = self.fetch_tag::<Category>("category");
let loaders = self.fetch_tag::<Loader>("loader");
let game_versions = self.fetch_tag::<GameVersion>("game_version");
let licenses = self.fetch_tag::<License>("license");
let donation_platforms =
self.fetch_tag::<DonationPlatform>("donation_platform");
let report_types = self.fetch_tag::<String>("report_type");
let categories = self.fetch_tag("category");
let loaders = self.fetch_tag("loader");
let game_versions = self.fetch_tag("game_version");
let licenses = self.fetch_tag("license");
let donation_platforms = self.fetch_tag("donation_platform");
let report_types = self.fetch_tag("report_type");
let (
categories,
@@ -149,59 +148,60 @@ impl Tags {
licenses,
donation_platforms,
report_types,
) = futures::join!(
) = tokio::try_join!(
categories,
loaders,
game_versions,
licenses,
donation_platforms,
report_types
);
)?;
// Store the tags in the database
self.0.categories.insert(
"categories",
bincode::encode_to_vec(categories?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(categories.json().await?, *BINCODE_CONFIG)?,
)?;
self.0.loaders.insert(
"loaders",
bincode::encode_to_vec(loaders?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(loaders.json().await?, *BINCODE_CONFIG)?,
)?;
self.0.game_versions.insert(
"game_versions",
bincode::encode_to_vec(game_versions?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(
game_versions.json().await?,
*BINCODE_CONFIG,
)?,
)?;
self.0.licenses.insert(
"licenses",
bincode::encode_to_vec(licenses?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(licenses.json().await?, *BINCODE_CONFIG)?,
)?;
self.0.donation_platforms.insert(
"donation_platforms",
bincode::encode_to_vec(donation_platforms?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(
donation_platforms.json().await?,
*BINCODE_CONFIG,
)?,
)?;
self.0.report_types.insert(
"report_types",
bincode::encode_to_vec(report_types?, *BINCODE_CONFIG)?,
bincode::encode_to_vec(
report_types.json().await?,
*BINCODE_CONFIG,
)?,
)?;
Ok(())
}
#[tracing::instrument(skip(self))]
pub async fn fetch_tag<T>(
pub async fn fetch_tag(
&self,
tag_type: &str,
) -> Result<Vec<T>, reqwest::Error>
where
T: serde::de::DeserializeOwned,
{
) -> Result<reqwest::Response, reqwest::Error> {
let url = &format!("{MODRINTH_API_URL}tag/{}", tag_type);
let content = REQWEST_CLIENT
.get(url)
.send()
.await?
.json::<Vec<T>>()
.await?;
let content = REQWEST_CLIENT.get(url).send().await?;
Ok(content)
}
}