diff --git a/crates/app/src/public/html/components.lisp b/crates/app/src/public/html/components.lisp index 75f9620..9b5f567 100644 --- a/crates/app/src/public/html/components.lisp +++ b/crates/app/src/public/html/components.lisp @@ -114,9 +114,10 @@ (div ("style" "display: contents") (text "{{ self::post(post=post, owner=owner, secondary=secondary, community=community, show_community=show_community, can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}")) -(text "{%- endmacro %} {% macro post(post, owner, question=false, secondary=false, community=false, show_community=true, can_manage_post=false, repost=false, expect_repost=false, poll=false, dont_show_title=false) -%} {% if community and show_community and community.id != config.town_square or question %}") +(text "{%- endmacro %} {% macro post(post, owner, question=false, secondary=false, community=false, show_community=true, can_manage_post=false, repost=false, expect_repost=false, poll=false, dont_show_title=false, is_repost=false) -%} {% if community and show_community and community.id != config.town_square or question %}") (div ("class" "card-nest post_outer:{{ post.id }} post_outer") + ("is_repost" "{{ is_repost }}") (text "{% if question -%} {{ self::question(question=question[0], owner=question[1], profile=owner) }} {% else %}") (div ("class" "card small") @@ -235,7 +236,7 @@ ; content (span ("id" "post_content:{{ post.id }}") (text "{{ post.content|markdown|safe }}")) - (text "{% if expect_repost -%} {% if repost -%} {{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false) }} {% else %}") + (text "{% if expect_repost -%} {% if repost -%} {{ self::post(post=repost[1], owner=repost[0], secondary=not secondary, community=false, show_community=false, can_manage_post=false, is_repost=true) }} {% else %}") (div ("class" "card lowered red flex items-center gap-2") (text "{{ icon \"frown\" }}") diff --git a/crates/app/src/public/html/misc/achievements.lisp b/crates/app/src/public/html/misc/achievements.lisp index 4b21b5d..429c924 100644 --- a/crates/app/src/public/html/misc/achievements.lisp +++ b/crates/app/src/public/html/misc/achievements.lisp @@ -12,9 +12,12 @@ (icon (text "coffee")) (span (text "Welcome to {{ config.name }}!"))) (div - ("class" "card no_p_margin") + ("class" "card no_p_margin flex flex-col gap-2") (p (text "To help you move in, you'll be rewarded with small achievements for completing simple tasks on {{ config.name }}!")) - (p (text "You'll find out what each achievement is when you get it, so look around!")))) + (p (text "You'll find out what each achievement is when you get it, so look around!")) + (hr) + (span (b (text "Your progress: ")) (text "{{ percentage|round(method=\"floor\", precision=2) }}%")) + (div ("class" "poll_bar") ("style" "width: {{ percentage }}%")))) (div ("class" "card-nest") diff --git a/crates/app/src/public/js/atto.js b/crates/app/src/public/js/atto.js index 350b7a3..32c5b5f 100644 --- a/crates/app/src/public/js/atto.js +++ b/crates/app/src/public/js/atto.js @@ -1295,6 +1295,10 @@ ${option.input_element_type === "textarea" ? `${option.value}` : ""} `.post${outer ? "_outer" : ""}\\:${id}`, ), )) { + if (element.getAttribute("is_repost") === true) { + continue; + } + if (idx === 0) { idx += 1; continue; diff --git a/crates/app/src/routes/pages/misc.rs b/crates/app/src/routes/pages/misc.rs index 3b99c5d..1abc14b 100644 --- a/crates/app/src/routes/pages/misc.rs +++ b/crates/app/src/routes/pages/misc.rs @@ -10,7 +10,7 @@ use axum::{ use axum_extra::extract::CookieJar; use serde::Deserialize; use tetratto_core::model::{ - auth::{AchievementName, DefaultTimelineChoice}, + auth::{AchievementName, DefaultTimelineChoice, ACHIEVEMENTS}, permissions::FinePermission, requests::ActionType, Error, @@ -473,6 +473,11 @@ pub async fn achievements_request( // ... let lang = get_lang!(jar, data.0); let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await; + + context.insert( + "percentage", + &((achievements.len() as f32 / ACHIEVEMENTS as f32) * 100.0), + ); context.insert("achievements", &achievements); // return