Compare commits
4 Commits
b9632e55d5
...
a5180e4ee9
| Author | SHA1 | Date | |
|---|---|---|---|
| a5180e4ee9 | |||
|
3eb1da8319
|
|||
|
30254864a9
|
|||
|
18f420c7d4
|
@@ -113,31 +113,13 @@ impl Quote {
|
||||
None => Ok(None),
|
||||
}
|
||||
}
|
||||
pub fn get_chronological_cursorscroll(
|
||||
conn: &Connection,
|
||||
cursor: Option<Uuid>,
|
||||
amount: i64,
|
||||
) -> Result<Vec<Quote>, QuoteError> {
|
||||
let ids = match cursor {
|
||||
Some(c) => conn
|
||||
.prepare("SELECT id FROM quotes WHERE id < ?1 ORDER BY id DESC LIMIT ?2")?
|
||||
.query_map((c, amount), |r| r.get(0))?
|
||||
.collect::<Result<Vec<Uuid>, _>>()?,
|
||||
None => conn
|
||||
.prepare("SELECT id FROM quotes ORDER BY id DESC LIMIT ?1")?
|
||||
.query_map((amount,), |r| r.get(0))?
|
||||
.collect::<Result<Vec<Uuid>, _>>()?,
|
||||
};
|
||||
|
||||
ids.iter().map(|id| Self::get_by_id(conn, *id)).collect()
|
||||
}
|
||||
pub fn get_chronological_offset(
|
||||
conn: &Connection,
|
||||
offset: i64,
|
||||
limit: i64,
|
||||
) -> Result<Vec<Quote>, QuoteError> {
|
||||
let ids = conn
|
||||
.prepare("SELECT id FROM quotes ORDER BY id DESC LIMIT ?1 OFFSET ?2")?
|
||||
.prepare("SELECT id FROM quotes ORDER BY timestamp DESC LIMIT ?1 OFFSET ?2")?
|
||||
.query_map((limit, offset), |r| r.get(0))?
|
||||
.collect::<Result<Vec<Uuid>, _>>()?;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ pub fn nav(user: Option<&User>, uri: &str) -> Markup {
|
||||
div class="w-px h-5 bg-neutral-200/15 hidden sm:block" {}
|
||||
div class="flex flex-row" {
|
||||
@for link in LINKS {
|
||||
@if !link.3 || user.is_some() {
|
||||
@if (!link.3 || user.is_some()) && link.0 != "Photos" {
|
||||
a href={(link.1)} class="flex flex-row px-2 py-1 rounded items-center gap-2 hover:bg-neutral-200/5 border border-transparent hover:border-neutral-200/25" {
|
||||
@if uri.starts_with(link.1) {
|
||||
div class="scale-[.75] text-neutral-300" {(PreEscaped(link.2))}
|
||||
|
||||
@@ -43,7 +43,7 @@ pub async fn page(req: Request) -> Result<Response, AuthError> {
|
||||
}
|
||||
}
|
||||
@if let Ok(tags) = Tag::get_all(&conn) {
|
||||
div class="max-w-4xl mx-auto mt-4 flex flex-wrap gap-2" {
|
||||
div class="max-w-4xl mx-auto px-2 mt-4 flex flex-wrap gap-2" {
|
||||
@for tag in &tags {
|
||||
div class="rounded-full px-3 py-1 bg-neutral-200/10 border border-neutral-200/15 flex" {
|
||||
span class="text-neutral-400 text-sm" {"#"}
|
||||
|
||||
Reference in New Issue
Block a user