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

Nft paging improvements #312

Merged
merged 30 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fc248dc
add total nfts for pagination
dkackman Jan 25, 2025
423e2c9
add total nfts for pagination
dkackman Jan 25, 2025
8860ea0
Enhance Pagination component with optional total and load more support
Ganbin Jan 25, 2025
175216f
Merge pull request #1 from Ganbin/pagination
dkackman Jan 25, 2025
37a4a2a
make page sizes settable
dkackman Jan 25, 2025
bffefb1
Improve pagination and grid layout accessibility and responsiveness
dkackman Jan 25, 2025
44e9118
add cols-6
dkackman Jan 26, 2025
8c9a05f
use query builder
dkackman Jan 26, 2025
d7b9259
add compact mode to pagination component
dkackman Jan 26, 2025
01d43b7
add total to get_nft_collections
dkackman Jan 26, 2025
fd3ebe9
proper paging for collections
dkackman Jan 26, 2025
fea5663
minter did paging
dkackman Jan 26, 2025
a5e9ac5
minter paging in the ui
dkackman Jan 26, 2025
cac6dcf
move Unknown minter handling into useNftData
dkackman Jan 26, 2025
b801099
Move Unassigned Nfts into useNftData and out of ui
dkackman Jan 26, 2025
ba0201a
move No Collection into useNftData
dkackman Jan 26, 2025
4903c97
lint
dkackman Jan 26, 2025
414e6b9
accessibility attributes
dkackman Jan 26, 2025
ba6fdd2
prettier
dkackman Jan 26, 2025
c4c3d0a
fix CI build failure
dkackman Jan 26, 2025
7aab711
prettier
dkackman Jan 26, 2025
e51b6c2
use count over for search_nfts
dkackman Feb 2, 2025
584fa00
use count over for minter queries
dkackman Feb 2, 2025
72fdf1a
consistent ordering of paging parameters
dkackman Feb 2, 2025
3aae400
use count over for collections
dkackman Feb 2, 2025
36874d5
Merge branch 'main' into nft-paging
dkackman Feb 2, 2025
8c8c076
fix post merge build error
dkackman Feb 2, 2025
7df94a8
search_nftsadd toggle view size setting for nft cards
dkackman Feb 2, 2025
1a1a09d
rearrange view setting buttons
dkackman Feb 2, 2025
7643192
prettier
dkackman Feb 2, 2025
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

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion crates/sage-api/src/requests/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ pub struct GetDidsResponse {

#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
#[cfg_attr(feature = "tauri", derive(specta::Type))]
pub struct GetMinterDidIds {}
pub struct GetMinterDidIds {
pub offset: u32,
pub limit: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "tauri", derive(specta::Type))]
pub struct GetMinterDidIdsResponse {
pub did_ids: Vec<String>,
pub total: u32,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
Expand Down Expand Up @@ -147,6 +151,7 @@ pub struct GetNftCollections {
#[cfg_attr(feature = "tauri", derive(specta::Type))]
pub struct GetNftCollectionsResponse {
pub collections: Vec<NftCollectionRecord>,
pub total: u32,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -182,6 +187,7 @@ pub struct GetNfts {
#[cfg_attr(feature = "tauri", derive(specta::Type))]
pub struct GetNftsResponse {
pub nfts: Vec<NftRecord>,
pub total: u32,
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
Expand Down
15 changes: 15 additions & 0 deletions crates/sage-database/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ impl Database {

Ok(())
}

/// Count collections, optionally including hidden ones
pub async fn count_collections(&self, include_hidden: bool) -> Result<i64> {
let count: i64 = if include_hidden {
sqlx::query_scalar!("SELECT COUNT(*) FROM collections")
.fetch_one(&self.pool)
.await?
} else {
sqlx::query_scalar!("SELECT COUNT(*) FROM collections WHERE visible = 1")
.fetch_one(&self.pool)
.await?
};

Ok(count)
}
}

#[derive(Debug)]
Expand Down
Loading
Loading