forge
Explore
Log in

Don't you dare go Hollow

A face at its own size, and every fact in a named cell

Browse files at this commit

3019970cadc1696961cffacbc6ea930830a807f3Ahmet Kaan GümüşParent: ee25951
  • fix
    • a face at its own size, and every fact in a named cell
Show full message
💄 fix(profile): a face at its own size, and every fact in a named cell

The profile page put a 92px picture on the screen and the browser drew it at
18. The Instrument skin sizes `.avatar` from a `[data-ui]` scope, which
outweighs a lone class, so every size modifier on that skin had quietly
collapsed to 18px — the comment avatars too, for as long as the skin has
existed. The three sizes are written `.avatar.avatar-lg` now, which is the
weight the skin rule already had, and the picture leads the page at 92px.

The rest of the page was two lines of text hanging in a box. The name and
the chips sit beside the picture; underneath, every fact is a named cell in
one ruled row — EMAIL, JOINED, LAST SEEN and, for anybody who was invited,
INVITED BY, which is a link to the person who let them in. The counts are
four bordered cells with the number leading. Recent activity is ruled rows:
what they did, the card's key, its title as a link to the card, the day.

And a face now leads to the person it belongs to: the comment author's
picture and name, and an assignee chip in the task modal, both go to
`/people/{id}` — the members table and the user menu already did. Board
cards are left alone deliberately: the card is itself a link, and an anchor
inside an anchor is not markup, it is a card that stops opening.

The board's project filter and the card's tag picker are typed into now
(`data-search`, the same pickers the logs page has). A workspace with thirty
projects is not a list to scroll past.
crates/izlek-web/src/board.rsmodified+1 -1
@@ -630,7 +630,7 @@ pub async fn board_page(cx: &Cx, user: &User) -> Result {
630630 </form>
631631 <form class="field-box field-box-sort" method="get" action="/">
632632 <span class="field-text">(t(lang, Key::Project))</span>
633- <select class="status-select" name="tag" data-autosubmit="">
633+ <select class="status-select" name="tag" data-autosubmit="" data-search="">
634634 <option value="" selected=(tag_filter.is_none())>(t(lang, Key::AllTags))</option>
635635 for tag in &tags {
636636 <option value=(tag.id.clone()) selected=(tag_filter.as_deref() == Some(tag.id.as_str()))>(tag.name.clone())</option>
crates/izlek-web/src/detail.rsmodified+9 -5
@@ -1365,8 +1365,10 @@ async fn assignee_chip(
13651365 view! {
13661366 cx =>
13671367 <span class="assignee-chip">
1368- (crate::layout::avatar(cx, person, "avatar-sm").await?)
1369- <span class="assignee-name">(person.display_name.clone())</span>
1368+ <a class="person-link" href=(format!("/people/{}", person.id))>
1369+ (crate::layout::avatar(cx, person, "avatar-sm").await?)
1370+ <span class="assignee-name">(person.display_name.clone())</span>
1371+ </a>
13701372 if may_write {
13711373 <form class="assignee-drop" method="post" action="/api/unassign">
13721374 <input type="hidden" name="task_id" value=(task_id.to_string())>
@@ -1641,10 +1643,12 @@ async fn comment_row(cx: &Cx, comment: &Comment, zone: UtcOffset) -> Result {
16411643 view! {
16421644 cx =>
16431645 <div class="comment">
1644- (crate::layout::avatar(cx, &comment.author, "avatar-lg").await?)
1646+ <a class="person-link" href=(format!("/people/{}", comment.author.id))>
1647+ (crate::layout::avatar(cx, &comment.author, "avatar-lg").await?)
1648+ </a>
16451649 <div class="comment-said">
16461650 <div class="comment-head">
1647- <span class="comment-who">(comment.author.display_name.clone())</span>
1651+ <a class="comment-who person-link" href=(format!("/people/{}", comment.author.id))>(comment.author.display_name.clone())</a>
16481652 <span class="comment-when">(moment_label_in(comment.at, zone))</span>
16491653 </div>
16501654 <div class="comment-body">(comment.body.clone())</div>
@@ -1879,7 +1883,7 @@ pub async fn task_modal(cx: &Cx, task_id: &str, confirm_delete: bool, tab: Tab)
18791883 if may_write {
18801884 <form class="status-form" method="post" action="/api/set_task_tag">
18811885 <input type="hidden" name="task_id" value=(detail.id.clone())>
1882- <select class="status-select" name="tag_id" data-autosubmit="">
1886+ <select class="status-select" name="tag_id" data-autosubmit="" data-search="">
18831887 for tag in &tags {
18841888 <option value=(tag.id.clone()) selected=(Some(tag.id.as_str()) == detail.tag.as_ref().map(|t| t.id.as_str()))>(tag.name.clone())</option>
18851889 }
crates/izlek-web/src/i18n.rsmodified+9 -0
@@ -348,6 +348,9 @@ pub enum Key {
348348 TasksCreatedLabel,
349349 CommentsLabel,
350350 RecentActivity,
351+ JoinedLabel,
352+ LastSeenLabel,
353+ InvitedByLabel,
351354 MailBatchLabel,
352355 }
353356
@@ -989,6 +992,12 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
989992 (CommentsLabel, Tr) => "Yorumlar",
990993 (RecentActivity, En) => "Recent activity",
991994 (RecentActivity, Tr) => "Son etkinlik",
995+ (JoinedLabel, En) => "JOINED",
996+ (JoinedLabel, Tr) => "KATILDI",
997+ (LastSeenLabel, En) => "LAST SEEN",
998+ (LastSeenLabel, Tr) => "SON GÖRÜLME",
999+ (InvitedByLabel, En) => "INVITED BY",
1000+ (InvitedByLabel, Tr) => "DAVET EDEN",
9921001 (MailBatchLabel, En) => "Mail delay (minutes)",
9931002 (MailBatchLabel, Tr) => "Posta gecikmesi (dakika)",
9941003 }
crates/izlek-web/src/people.rsmodified+85 -43
@@ -19,16 +19,14 @@ use crate::server::{accounts, require_user};
1919
2020 path_param!(user_id);
2121
22-/// The account line the members table renders, read the same way here: a
23-/// named state (owner, invited) while there is nothing newer to say, and the
24-/// last-seen day once there is.
25-fn account_line(lang: Lang, is_owner: bool, has_signed_in: bool, last_day: Option<String>) -> String {
26- if is_owner {
27- t(lang, Key::OwnerStatus).to_string()
28- } else if !has_signed_in {
22+/// What the account itself is doing: the owner reads as the owner, somebody
23+/// who has never chosen a password reads as invited, and everybody else is
24+/// the day they were last here.
25+fn last_seen(lang: Lang, has_signed_in: bool, last_day: Option<String>) -> String {
26+ if !has_signed_in {
2927 t(lang, Key::InvitedStatus).to_string()
3028 } else if let Some(day) = last_day {
31- crate::i18n::last_seen_label(lang, &day)
29+ day
3230 } else {
3331 t(lang, Key::ActiveStatus).to_string()
3432 }
@@ -82,14 +80,20 @@ async fn people_page(cx: &Cx) -> Result {
8280 .owner()
8381 .await?
8482 .is_some_and(|owner| owner.id == person.id);
85- let account = account_line(
83+ let joined = izlek_core::board::day_label(person.created_at.to_offset(zone).date());
84+ let seen = last_seen(
8685 lang,
87- is_owner,
8886 person.has_signed_in(),
8987 person
9088 .last_signed_in_at
9189 .map(|at| izlek_core::board::day_label(at.to_offset(zone).date())),
9290 );
91+ // Who let them in, as a name that leads to that person's own page. The
92+ // first account was invited by nobody.
93+ let inviter = match &person.invited_by {
94+ Some(id) => store.user(id).await?,
95+ None => None,
96+ };
9397 let role_key = match person.role {
9498 izlek_core::Role::Admin => Key::RoleAdminOption,
9599 izlek_core::Role::Member => Key::RoleMemberOption,
@@ -117,52 +121,90 @@ async fn people_page(cx: &Cx) -> Result {
117121 </header>
118122
119123 <main class="people-shell">
120- <section class="panel" id="profile">
121- <div class="panel-head">
122- (crate::layout::avatar(cx, &who, "avatar-lg").await?)
123- <h2 class="panel-title">(person.display_name.clone())</h2>
124- <span class="chip chip-role">(t(lang, role_key))</span>
124+ <section class="panel person-card">
125+ <div class="person-head">
126+ (crate::layout::avatar(cx, &who, "avatar-xl").await?)
127+ <div class="person-heading">
128+ <h2 class="person-name">(person.display_name.clone())</h2>
129+ <div class="person-marks">
130+ <span class="chip chip-role">(t(lang, role_key))</span>
131+ if is_owner {
132+ <span class="chip chip-admin">(t(lang, Key::OwnerStatus))</span>
133+ }
134+ </div>
135+ </div>
125136 if mine {
126- <a class="quiet" href="/settings?section=profile">(t(lang, Key::EditLabel))</a>
137+ <a class="quiet person-edit" href="/settings?section=profile">(t(lang, Key::EditLabel))</a>
127138 }
128139 </div>
129- <div class="panel-body">
130- <p>(person.email.clone())</p>
131- <p>(account)</p>
132- </div>
140+ <dl class="person-fields">
141+ <div class="person-field">
142+ <dt>(t(lang, Key::EmailLabel))</dt>
143+ <dd class="person-address">(person.email.clone())</dd>
144+ </div>
145+ <div class="person-field">
146+ <dt>(t(lang, Key::JoinedLabel))</dt>
147+ <dd>(joined)</dd>
148+ </div>
149+ <div class="person-field">
150+ <dt>(t(lang, Key::LastSeenLabel))</dt>
151+ <dd>(seen)</dd>
152+ </div>
153+ if let Some(inviter) = inviter {
154+ <div class="person-field">
155+ <dt>(t(lang, Key::InvitedByLabel))</dt>
156+ <dd><a href=(format!("/people/{}", inviter.id))>(inviter.display_name.clone())</a></dd>
157+ </div>
158+ }
159+ </dl>
133160 </section>
134161
135162 <section class="panel">
136- <div class="panel-body">
137- <dl class="people-stats">
138- <div><dt>(t(lang, Key::TasksOpenLabel))</dt><dd>(stats.assigned_open)</dd></div>
139- <div><dt>(t(lang, Key::TasksDoneLabel))</dt><dd>(stats.assigned_done)</dd></div>
140- <div><dt>(t(lang, Key::TasksCreatedLabel))</dt><dd>(stats.created)</dd></div>
141- <div><dt>(t(lang, Key::CommentsLabel))</dt><dd>(stats.comments)</dd></div>
142- </dl>
143- </div>
163+ <dl class="person-stats">
164+ <div class="person-stat">
165+ <dd>(stats.assigned_open)</dd>
166+ <dt>(t(lang, Key::TasksOpenLabel))</dt>
167+ </div>
168+ <div class="person-stat">
169+ <dd>(stats.assigned_done)</dd>
170+ <dt>(t(lang, Key::TasksDoneLabel))</dt>
171+ </div>
172+ <div class="person-stat">
173+ <dd>(stats.created)</dd>
174+ <dt>(t(lang, Key::TasksCreatedLabel))</dt>
175+ </div>
176+ <div class="person-stat">
177+ <dd>(stats.comments)</dd>
178+ <dt>(t(lang, Key::CommentsLabel))</dt>
179+ </div>
180+ </dl>
144181 </section>
145182
146183 <section class="panel">
147184 <div class="panel-head">
148185 <h2 class="panel-title">(t(lang, Key::RecentActivity))</h2>
149186 </div>
150- <div class="panel-body">
151- if feed.is_empty() {
152- <p>(t(lang, Key::NothingYet))</p>
187+ if feed.is_empty() {
188+ <div class="panel-body"><p class="muted">(t(lang, Key::NothingYet))</p></div>
189+ }
190+ <ul class="person-feed">
191+ for line in feed {
192+ <li class="person-line">
193+ <span class="person-verb">(kind_word(lang, &line.kind))</span>
194+ if let Some(task_id) = line.task_id.clone() {
195+ <a class="person-task" href=(format!("/?task={task_id}"))>
196+ if let Some(key) = line.task_key.clone() {
197+ <span class="person-key">(key)</span>
198+ }
199+ <span class="person-title">(line.title.clone().unwrap_or_default())</span>
200+ </a>
201+ } else {
202+ <span class="person-title">(line.title.clone().unwrap_or_default())</span>
203+ }
204+ <span class="person-day">(izlek_core::board::day_label(line.at.to_offset(zone).date()))</span>
205+ </li>
153206 }
154- <ul class="people-feed">
155- for line in feed {
156- <li>
157- <span>(kind_word(lang, &line.kind))</span>
158- if let Some(title) = line.title {
159- <span>(title)</span>
160- }
161- <span class="people-feed-day">(izlek_core::board::day_label(line.at.to_offset(zone).date()))</span>
162- </li>
163- }
164- </ul>
165- </div>
207+ </ul>
166208 </section>
167209 </main>
168210
crates/izlek-web/tests/http.rsmodified+86 -0
@@ -7647,6 +7647,92 @@ async fn a_member_may_read_another_members_profile_name_address_and_counts() {
76477647 }
76487648 }
76497649
7650+/// Every fact on a profile sits in a named cell, and the person who let this
7651+/// member in is a link to their own page rather than a name in prose.
7652+#[tokio::test]
7653+async fn a_profile_names_its_fields_and_links_the_person_who_invited_them() {
7654+ let app = App::open().await;
7655+ let admin_cookie = admin(&app).await;
7656+ invited(&app, &admin_cookie, "mem@izlek.sh", "Mem Ber", Role::Member).await;
7657+ let mem_id = user_id(&app, "mem@izlek.sh").await;
7658+ let admin_id = app
7659+ .store
7660+ .users(&app.workspace_id().await)
7661+ .await
7662+ .unwrap()
7663+ .into_iter()
7664+ .find(|user| user.role == Role::Admin)
7665+ .unwrap()
7666+ .id;
7667+
7668+ let page = app.get(&format!("/people/{mem_id}"), Some(&admin_cookie)).await;
7669+ let html = String::from_utf8(page.bytes).unwrap();
7670+ for label in ["EMAIL", "JOINED", "LAST SEEN", "INVITED BY"] {
7671+ assert!(html.contains(label), "the {label} field is not on the page: {html}");
7672+ }
7673+ assert!(
7674+ html.contains(&format!(r#"href="/people/{admin_id}""#)),
7675+ "the inviter is not a way to their own page: {html}"
7676+ );
7677+ assert!(
7678+ html.contains("avatar-xl"),
7679+ "the profile picture is not the page's own size: {html}"
7680+ );
7681+
7682+ // The first account was invited by nobody, so it carries no such cell.
7683+ let owner = app.get(&format!("/people/{admin_id}"), Some(&admin_cookie)).await;
7684+ let owner_html = String::from_utf8(owner.bytes).unwrap();
7685+ assert!(
7686+ !owner_html.contains("INVITED BY"),
7687+ "the owner was invited by somebody: {owner_html}"
7688+ );
7689+}
7690+
7691+/// A face or a name in the task modal leads to the person it names.
7692+#[tokio::test]
7693+async fn a_comment_author_and_an_assignee_lead_to_their_profiles() {
7694+ let app = App::open().await;
7695+ let admin_cookie = admin(&app).await;
7696+ invited(&app, &admin_cookie, "mem@izlek.sh", "Mem Ber", Role::Member).await;
7697+ let mem_id = user_id(&app, "mem@izlek.sh").await;
7698+ let workspace_id = app.workspace_id().await;
7699+ let board = app.store.board(&workspace_id).await.unwrap().unwrap();
7700+ let open = app.store.columns(&board.id).await.unwrap()[0].id.clone();
7701+ let task = a_task_by(&app, &board.id, &open, "Hold the door", &mem_id).await;
7702+ app.store.assign_task(&task, &mem_id).await.unwrap();
7703+ app.store
7704+ .add_comment(&task, &mem_id, "a note", time::OffsetDateTime::now_utc())
7705+ .await
7706+ .unwrap();
7707+
7708+ let page = app
7709+ .get(&format!("/?task={task}&tab=comments"), Some(&admin_cookie))
7710+ .await;
7711+ let html = String::from_utf8(page.bytes).unwrap();
7712+ assert!(
7713+ html.matches(&format!(r#"href="/people/{mem_id}""#)).count() >= 2,
7714+ "the comment's author and the assignee do not both lead anywhere: {html}"
7715+ );
7716+}
7717+
7718+/// The board's project filter is typed into, like the pickers on the logs
7719+/// page: a workspace with many tags is not a list to scroll.
7720+#[tokio::test]
7721+async fn the_project_filter_is_written_into() {
7722+ let app = App::open().await;
7723+ let admin_cookie = admin(&app).await;
7724+ let page = app.get("/", Some(&admin_cookie)).await;
7725+ let html = String::from_utf8(page.bytes).unwrap();
7726+ let filter = html
7727+ .split("<select")
7728+ .find(|chunk| chunk.contains(r#"name="tag""#))
7729+ .unwrap_or_else(|| panic!("no project filter on the board: {html}"));
7730+ assert!(
7731+ filter.contains("data-search"),
7732+ "the project filter cannot be typed into: {filter}"
7733+ );
7734+}
7735+
76507736 #[tokio::test]
76517737 async fn a_profile_is_not_found_signed_out_or_outside_the_workspace() {
76527738 let app = App::open().await;
style/main.scssmodified+183 -18
@@ -941,14 +941,19 @@ a {
941941 // The modal asks for two other sizes: 18px inside an assignee chip, 28px
942942 // beside a comment. The border is the board's overlap trick and has no job
943943 // on a lone avatar, so these drop it.
944- &-sm {
944+ //
945+ // They are written as `.avatar.avatar-sm` on purpose: the Instrument skin
946+ // sizes `.avatar` from a `[data-ui]` scope, which outweighs a lone class —
947+ // a plain `.avatar-lg` lost to it, and every size modifier collapsed to
948+ // 18px on that skin without anybody noticing.
949+ &.avatar-sm {
945950 width: 18px;
946951 height: 18px;
947952 border: none;
948953 font-size: 10px;
949954 }
950955
951- &-lg {
956+ &.avatar-lg {
952957 width: 28px;
953958 height: 28px;
954959 border: none;
@@ -956,6 +961,17 @@ a {
956961 flex: none;
957962 }
958963
964+ // The profile page's own picture: the one place a face is the subject of
965+ // the screen rather than a mark beside somebody's name.
966+ &.avatar-xl {
967+ width: 92px;
968+ height: 92px;
969+ border: none;
970+ font-size: 30px;
971+ font-weight: 500;
972+ flex: none;
973+ }
974+
959975 // A bare avatar carries `data-name`; hovering raises a house tooltip in
960976 // place of the native `title`.
961977 &[data-name]:hover::after {
@@ -3561,43 +3577,192 @@ input[type="radio"] {
35613577 > * { flex: none; }
35623578 }
35633579
3564-.people-stats {
3580+// A face or a name that leads to the person it names. The chrome stays the
3581+// chrome — the link exists to be clicked, not to look like one.
3582+.person-link {
3583+ display: inline-flex;
3584+ align-items: center;
3585+ gap: inherit;
3586+ color: inherit;
3587+ text-decoration: none;
3588+ min-width: 0;
3589+
3590+ &:hover { text-decoration: underline; }
3591+}
3592+
3593+.person-card {
3594+ overflow: hidden;
3595+}
3596+
3597+// The head is the identity: a picture big enough to be a picture, the name,
3598+// what the workspace calls this person, and — on your own page only — the way
3599+// to the one screen that can change any of it.
3600+.person-head {
35653601 display: flex;
3566- flex-wrap: wrap;
3567- gap: 28px;
3602+ align-items: center;
3603+ gap: 18px;
3604+ padding: 22px 22px 20px;
3605+}
3606+
3607+.person-heading {
3608+ display: flex;
3609+ flex-direction: column;
3610+ gap: 8px;
3611+ min-width: 0;
3612+}
3613+
3614+.person-name {
35683615 margin: 0;
3616+ font-family: var(--font-display);
3617+ font-size: 22px;
3618+ font-weight: 600;
3619+ line-height: 1.1;
3620+ overflow: hidden;
3621+ text-overflow: ellipsis;
3622+ white-space: nowrap;
3623+}
3624+
3625+.person-marks {
3626+ display: flex;
3627+ align-items: center;
3628+ gap: 6px;
3629+}
3630+
3631+.person-edit {
3632+ margin-left: auto;
3633+ flex: none;
3634+}
3635+
3636+// Every fact sits in a named cell instead of floating as a line of text. The
3637+// cells share the panel's own hairlines, so the block reads as one table
3638+// rather than as paragraphs that happen to be near each other.
3639+.person-fields {
3640+ display: grid;
3641+ grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
3642+ margin: 0;
3643+ border-top: 1px solid var(--border);
3644+}
3645+
3646+.person-field {
3647+ padding: 12px 22px 14px;
3648+ min-width: 0;
3649+ border-right: 1px solid var(--border);
3650+
3651+ &:last-child { border-right: none; }
35693652
35703653 dt {
3571- font-size: 11px;
3572- letter-spacing: 0.08em;
3573- text-transform: uppercase;
3654+ font-size: 10px;
3655+ letter-spacing: 0.09em;
35743656 color: var(--muted);
35753657 }
35763658
3659+ dd {
3660+ margin: 4px 0 0;
3661+ font-size: 13px;
3662+ color: var(--ink);
3663+ overflow: hidden;
3664+ text-overflow: ellipsis;
3665+ white-space: nowrap;
3666+ }
3667+}
3668+
3669+.person-field dd.person-address {
3670+ font-family: var(--font-mono);
3671+ font-size: 12px;
3672+}
3673+
3674+// The hover tooltip names a face that is standing beside its own name.
3675+.person-head .avatar[data-name]:hover::after { content: none; }
3676+
3677+// Four counts, four boxes. The number leads and the label sits under it, so a
3678+// column reads as one thing rather than as a word with a digit beside it.
3679+.person-stats {
3680+ display: grid;
3681+ grid-template-columns: repeat(4, 1fr);
3682+ margin: 0;
3683+
3684+ @media (max-width: 620px) {
3685+ grid-template-columns: repeat(2, 1fr);
3686+ }
3687+}
3688+
3689+.person-stat {
3690+ padding: 16px 22px 18px;
3691+ border-right: 1px solid var(--border);
3692+
3693+ &:last-child { border-right: none; }
3694+
35773695 dd {
35783696 margin: 0;
3579- font-size: 20px;
3580- font-weight: 600;
3697+ font-family: var(--font-mono);
3698+ font-size: 26px;
3699+ font-weight: 500;
3700+ line-height: 1.1;
35813701 font-variant-numeric: tabular-nums;
35823702 }
3703+
3704+ dt {
3705+ margin-top: 6px;
3706+ font-size: 10px;
3707+ letter-spacing: 0.09em;
3708+ text-transform: uppercase;
3709+ color: var(--muted);
3710+ }
35833711 }
35843712
3585-.people-feed {
3713+.person-feed {
35863714 list-style: none;
35873715 margin: 0;
35883716 padding: 0;
3717+}
3718+
3719+.person-line {
35893720 display: flex;
3590- flex-direction: column;
3721+ align-items: baseline;
3722+ gap: 12px;
3723+ padding: 9px 18px;
3724+ border-top: 1px solid var(--border);
3725+ min-width: 0;
3726+
3727+ &:first-child { border-top: none; }
3728+ &:hover { background: var(--surface-muted); }
3729+}
3730+
3731+.person-verb {
3732+ flex: none;
3733+ width: 88px;
3734+ font-size: 11px;
3735+ letter-spacing: 0.06em;
3736+ text-transform: uppercase;
3737+ color: var(--muted);
3738+}
3739+
3740+.person-task {
3741+ display: flex;
3742+ align-items: baseline;
35913743 gap: 8px;
3744+ min-width: 0;
3745+ color: inherit;
3746+ text-decoration: none;
35923747
3593- li {
3594- display: flex;
3595- align-items: baseline;
3596- gap: 10px;
3597- }
3748+ &:hover .person-title { text-decoration: underline; }
3749+}
3750+
3751+.person-key {
3752+ flex: none;
3753+ font-family: var(--font-mono);
3754+ font-size: 11px;
3755+ color: var(--muted);
3756+}
3757+
3758+.person-title {
3759+ overflow: hidden;
3760+ text-overflow: ellipsis;
3761+ white-space: nowrap;
3762+ font-size: 13px;
35983763 }
35993764
3600-.people-feed-day {
3765+.person-day {
36013766 margin-left: auto;
36023767 flex: none;
36033768 white-space: nowrap;