diff --git a/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs b/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs index d3e6875..cf49e20 100644 --- a/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs +++ b/crates/forge-e2e/tests/e2e/repo_settings_e2e.rs @@ -379,7 +379,7 @@ async fn repo_settings_deletes_rows_when_repo_dir_is_missing() { /// of its summary pills. The built-in default-branch row has no rule behind it, so it is skipped. fn branch_rows(body: &str) -> Vec> { let doc = scraper::Html::parse_document(body); - // Every rule row is a `details` with the pattern in its summary's name; the "+ New rule" row + // Every rule row is a `details` with the pattern in its summary's name; the "Add rule" row // has no pattern there, so it drops out. let cards = scraper::Selector::parse("details.row-open").expect("selector"); let pattern = scraper::Selector::parse("summary .name code").expect("selector"); @@ -464,7 +464,7 @@ async fn branch_protection_end_to_end() { assert_eq!(page.status, 200, "owner settings page"); assert!(page.body.contains("Branch protection"), "section missing"); assert!( - page.body.contains("(default branch): protected by default"), + page.body.contains("protected by default"), "built-in row missing" ); let danger_page = http @@ -515,7 +515,7 @@ async fn branch_protection_end_to_end() { "main card after add" ); assert!( - !page.body.contains("(default branch): protected by default"), + !page.body.contains("protected by default"), "built-in row must disappear once a rule matches" ); @@ -626,7 +626,7 @@ async fn branch_protection_end_to_end() { .await; assert!(rule_row(&page.body, "main").is_none(), "main removed"); assert!( - page.body.contains("(default branch): protected by default"), + page.body.contains("protected by default"), "built-in row back after remove" ); @@ -648,7 +648,7 @@ async fn branch_protection_end_to_end() { http.get("/bob/app/settings?section=branches", Some(&bob)) .await .body - .contains("(default branch): protected by default"), + .contains("protected by default"), "write collaborator must not change rules" ); diff --git a/crates/forge-web-base/src/i18n/merge_queue.rs b/crates/forge-web-base/src/i18n/merge_queue.rs index 5986644..7eda808 100644 --- a/crates/forge-web-base/src/i18n/merge_queue.rs +++ b/crates/forge-web-base/src/i18n/merge_queue.rs @@ -92,8 +92,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { use K::*; use Lang::{En, Tr}; match (key, lang) { - (RequireMergeQueue, En) => "Require merge queue", - (RequireMergeQueue, Tr) => "Birleştirme sırası iste", + (RequireMergeQueue, En) => "Merge queue", + (RequireMergeQueue, Tr) => "Birleştirme sırası", (RequireMergeQueueHint, En) => { "Merges go through the merge queue. Each pull request is tested on top of the current branch tip, and the branch moves only to a tested commit." } diff --git a/crates/forge-web-base/src/i18n/repo_admin.rs b/crates/forge-web-base/src/i18n/repo_admin.rs index a752e5b..8207a2c 100644 --- a/crates/forge-web-base/src/i18n/repo_admin.rs +++ b/crates/forge-web-base/src/i18n/repo_admin.rs @@ -13,7 +13,6 @@ pub enum K { AllowDeletion, AllowForcePush, AlreadyOwner, - ApprovalsHelp, ApprovalsRange, ArchiveHeading, ArchiveHelp, @@ -49,7 +48,6 @@ pub enum K { DeleteRepoHelp, DeleteTrashHelp, DeletionAllowed, - DeletionDesc, Description, DescriptionHelp, DescriptionLong, @@ -57,7 +55,6 @@ pub enum K { EnterUsername, EnterValue, ForcePushAllowed, - ForcePushDesc, General, GeneralSaved, MakePublic, @@ -69,17 +66,14 @@ pub enum K { NameRule, NewName, NewOwnerLabel, - NewRule, + AddRule, NoBranchesYet, NoCollaborators, NoPendingTransfer, NoSecrets, NotCollaborator, OwnerIsMember, - PatternHelpA, - PatternHelpB, - PatternHelpC, - PatternHelpD, + PatternHelp, PendingTransfers, PrivateOption, PublicOption, @@ -96,7 +90,6 @@ pub enum K { RepoUnarchived, RequireUpToDate, RequiredApprovals, - RestrictPushDesc, RestrictPushTitle, Role, RoleAdminDesc, @@ -107,7 +100,6 @@ pub enum K { RoleUpdated, RoleWriteDesc, RequiredChecks, - RequiredChecksHelp, RecentContexts, RuleChangesShort, RuleNoExtra, @@ -124,7 +116,7 @@ pub enum K { Secrets, SecretsHelp, SectionChecks, - SectionMerging, + SectionPullRequests, SectionPattern, SectionPushes, SettingsNavLabel, @@ -167,18 +159,12 @@ pub fn t(lang: Lang, key: K) -> &'static str { } (AddOrUpdate, En) => "Add or update a secret", (AddOrUpdate, Tr) => "Gizli anahtar ekle veya güncelle", - (AllowDeletion, En) => "Allow deletion", - (AllowDeletion, Tr) => "Silmeye izin verilir", - (AllowForcePush, En) => "Allow force pushes", - (AllowForcePush, Tr) => "Zorla göndermeye izin verilir", + (AllowDeletion, En) => "Deleting the branch", + (AllowDeletion, Tr) => "Dalın silinmesi", + (AllowForcePush, En) => "Force pushes", + (AllowForcePush, Tr) => "Zorla gönderim", (AlreadyOwner, En) => "The repository already belongs to that user.", (AlreadyOwner, Tr) => "Depo zaten bu kullanıcıya ait.", - (ApprovalsHelp, En) => { - "How many a pull needs, 0 to 20. They count only from reviewers with Write access or higher, using each reviewer's latest review." - } - (ApprovalsHelp, Tr) => { - "Bir çekme isteğinin gereken onay sayısı, 0 ile 20 arası. Onaylar yalnızca yazma veya daha yüksek erişimi olan inceleyicilerden, her inceleyicinin en son incelemesine göre sayılır." - } (ApprovalsRange, En) => "required approvals must be a whole number from 0 to 20", (ApprovalsRange, Tr) => "Gerekli onay sayısı 0 ile 20 arasında bir tam sayı olmalıdır.", (ArchiveHeading, En) => "Archive", @@ -205,30 +191,26 @@ pub fn t(lang: Lang, key: K) -> &'static str { (ArchivedSecrets, Tr) => "Bu depo arşivlenmiş. Gizli anahtarlar salt okunurdur.", (BadForm, En) => "The form was not understood. Nothing was changed.", (BadForm, Tr) => "Form anlaşılamadı. Hiçbir şey değiştirilmedi.", - (BlockWhileChanges, En) => "Block merges while changes are requested", - (BlockWhileChanges, Tr) => "Değişiklik istenirken birleştirmeler engellenir", + (BlockWhileChanges, En) => "Block while changes are requested", + (BlockWhileChanges, Tr) => "Değişiklik istenirken engelle", (BranchMissing, En) => "That branch does not exist. Nothing was saved.", (BranchMissing, Tr) => "Bu dal mevcut değil. Hiçbir şey kaydedilmedi.", - (BranchPattern, En) => "Branch pattern", - (BranchPattern, Tr) => "Dal deseni", + (BranchPattern, En) => "Branch", + (BranchPattern, Tr) => "Dal", (BranchProtection, En) => "Branch protection", (BranchProtection, Tr) => "Dal koruması", (BranchProtectionHelp, En) => { - "Pushes to a protected branch are checked before they are accepted. Force pushes and deletions are blocked on the default branch unless a rule allows them. Tags are not covered." + "A push to a protected branch is checked against its rule before it is accepted." } (BranchProtectionHelp, Tr) => { - "Korumalı bir dala yapılan gönderimler kabul edilmeden önce denetlenir. Bir kural izin vermedikçe varsayılan dalda zorla gönderimler ve silmeler engellenir. Etiketler kapsam dışındadır." + "Korumalı bir dala yapılan gönderim, kabul edilmeden önce kuralına göre denetlenir." } (BranchRuleRemoved, En) => "Branch rule removed.", (BranchRuleRemoved, Tr) => "Dal kuralı kaldırıldı.", (BranchRuleSaved, En) => "Branch rule saved.", (BranchRuleSaved, Tr) => "Dal kuralı kaydedildi.", - (BuiltinRowText, En) => { - " (default branch): protected by default; add a rule for it to change this." - } - (BuiltinRowText, Tr) => { - " (varsayılan dal): varsayılan olarak korunur; bunu değiştirmek için bir kural ekleyin." - } + (BuiltinRowText, En) => "protected by default", + (BuiltinRowText, Tr) => "varsayılan olarak korunur", (CancelRule, En) => "Cancel", (CancelRule, Tr) => "Vazgeç", (CancelTransfer, En) => "Cancel transfer", @@ -277,9 +259,7 @@ pub fn t(lang: Lang, key: K) -> &'static str { } (DeletionAllowed, En) => "Deletion allowed", (DeletionAllowed, Tr) => "Silmeye izin var", - (DeletionDesc, En) => "The branch can be deleted.", (Description, En) => "Description", - (DeletionDesc, Tr) => "Dal silinebilir.", (Description, Tr) => "Açıklama", (DescriptionHelp, En) => { "Up to 350 characters, on one line. It is shown under the repository name." @@ -301,9 +281,7 @@ pub fn t(lang: Lang, key: K) -> &'static str { (EnterValue, Tr) => "Bir değer girin.", (ForcePushAllowed, En) => "Force push allowed", (ForcePushAllowed, Tr) => "Zorla gönderime izin var", - (ForcePushDesc, En) => "Rewriting history with git push --force is allowed.", (General, En) => "General", - (ForcePushDesc, Tr) => "git push --force ile geçmişin yeniden yazılmasına izin verilir.", (General, Tr) => "Genel", (GeneralSaved, En) => "General settings saved.", (GeneralSaved, Tr) => "Genel ayarlar kaydedildi.", @@ -333,11 +311,11 @@ pub fn t(lang: Lang, key: K) -> &'static str { (NewName, Tr) => "Yeni ad", (NewOwnerLabel, En) => "New owner (username)", (NewOwnerLabel, Tr) => "Yeni sahip (kullanıcı adı)", - (NewRule, En) => "New rule", + (AddRule, En) => "Add rule", + (AddRule, Tr) => "Kural ekle", (NoBranchesYet, En) => { "No branches yet. The default branch can be chosen after the first push." } - (NewRule, Tr) => "Yeni kural", (NoBranchesYet, Tr) => "Henüz dal yok. Varsayılan dal, ilk gönderimden sonra seçilebilir.", (NoCollaborators, En) => "No collaborators yet.", (NoCollaborators, Tr) => "Henüz ortak çalışan yok.", @@ -353,16 +331,8 @@ pub fn t(lang: Lang, key: K) -> &'static str { (OwnerIsMember, Tr) => { "Depo sahibi zaten tam erişimli bir üyedir ve ortak çalışan olarak eklenemez." } - (PatternHelpA, En) => "A branch name, or a pattern: ", - (PatternHelpA, Tr) => "Bir dal adı veya desen: ", - (PatternHelpB, En) => " matches within one path segment and ", - (PatternHelpB, Tr) => " tek yol parçası içinde eşleşir, ", - (PatternHelpC, En) => " matches across ", - (PatternHelpC, Tr) => " ise ", - (PatternHelpD, En) => ".", - (PatternHelpD, Tr) => { - " işaretini de aşarak eşleşir." - } + (PatternHelp, En) => "A name, or * and ** patterns.", + (PatternHelp, Tr) => "Bir ad veya * ve ** desenleri.", (PendingTransfers, En) => "Pending transfers", (PendingTransfers, Tr) => "Bekleyen devirler", (PrivateOption, En) => { @@ -399,17 +369,13 @@ pub fn t(lang: Lang, key: K) -> &'static str { (RepoTransfers, Tr) => "Depo devirleri", (RepoUnarchived, En) => "Repository unarchived.", (RepoUnarchived, Tr) => "Depo arşivden çıkarıldı.", - (RequireUpToDate, En) => "Require the pull request head to contain the latest base branch", - (RequireUpToDate, Tr) => { - "Çekme isteğinin kaynak dalı, hedef dalın en son hâlini içermelidir" - } + (RequireUpToDate, En) => "Up to date with the base branch", + (RequireUpToDate, Tr) => "Hedef dalla güncel", (RequiredApprovals, En) => "Approvals", (RequiredApprovals, Tr) => "Onaylar", - (RestrictPushDesc, En) => "Direct pushes are limited to repo admins.", - (RestrictPushTitle, En) => "Only accept changes through pull requests", + (RestrictPushTitle, En) => "Only through pull requests", (Role, En) => "Role", - (RestrictPushDesc, Tr) => "Doğrudan gönderimler depo yöneticileriyle sınırlıdır.", - (RestrictPushTitle, Tr) => "Değişiklikler yalnızca çekme istekleri üzerinden kabul edilir", + (RestrictPushTitle, Tr) => "Yalnızca çekme istekleri üzerinden", (Role, Tr) => "Rol", (RoleAdminDesc, En) => "full repo settings except delete and transfer", (RoleAdminDesc, Tr) => "silme ve devir dışında tüm depo ayarları", @@ -427,12 +393,6 @@ pub fn t(lang: Lang, key: K) -> &'static str { (RoleWriteDesc, Tr) => "gönderme (push)", (RequiredChecks, En) => "Required status checks", (RequiredChecks, Tr) => "Gerekli durum denetimleri", - (RequiredChecksHelp, En) => { - "Contexts that must be successful on the pull request head before it can merge, separated by commas. CI jobs report as ci/." - } - (RequiredChecksHelp, Tr) => { - "Birleştirmeden önce çekme isteğinin son commit'inde başarılı olması gereken bağlamlar, virgülle ayrılır. CI işleri ci/ olarak bildirilir." - } (RecentContexts, En) => "Recently seen:", (RecentContexts, Tr) => "Son görülenler:", (RuleChangesShort, En) => "Blocks on changes requested", @@ -467,13 +427,13 @@ pub fn t(lang: Lang, key: K) -> &'static str { (SecretsHelp, Tr) => { "Gizli anahtarlar, bu deponun CI işlerine ortam değişkeni olarak aktarılır. Değerler yalnızca yazılabilir: kaydedildikten sonra geri okunamazlar ve bir gizli anahtarı güncellemek değerini değiştirir." } - (SectionChecks, En) => "Status checks", - (SectionMerging, En) => "Merging", + (SectionChecks, En) => "Checks", + (SectionPullRequests, En) => "Pull requests", (SectionPattern, En) => "Pattern", (SectionPushes, En) => "Pushes", (SettingsNavLabel, En) => "Settings", - (SectionChecks, Tr) => "Durum denetimleri", - (SectionMerging, Tr) => "Birleştirme", + (SectionChecks, Tr) => "Denetimler", + (SectionPullRequests, Tr) => "Çekme istekleri", (SectionPattern, Tr) => "Desen", (SectionPushes, Tr) => "Gönderimler", (SettingsNavLabel, Tr) => "Ayarlar", @@ -679,7 +639,6 @@ mod tests { K::AllowDeletion, K::AllowForcePush, K::AlreadyOwner, - K::ApprovalsHelp, K::ApprovalsRange, K::ArchiveHeading, K::ArchiveHelp, @@ -715,7 +674,6 @@ mod tests { K::DeleteRepoHelp, K::DeleteTrashHelp, K::DeletionAllowed, - K::DeletionDesc, K::Description, K::DescriptionHelp, K::DescriptionLong, @@ -723,7 +681,6 @@ mod tests { K::EnterUsername, K::EnterValue, K::ForcePushAllowed, - K::ForcePushDesc, K::General, K::GeneralSaved, K::MakePublic, @@ -735,17 +692,14 @@ mod tests { K::NameRule, K::NewName, K::NewOwnerLabel, - K::NewRule, + K::AddRule, K::NoBranchesYet, K::NoCollaborators, K::NoPendingTransfer, K::NoSecrets, K::NotCollaborator, K::OwnerIsMember, - K::PatternHelpA, - K::PatternHelpB, - K::PatternHelpC, - K::PatternHelpD, + K::PatternHelp, K::PendingTransfers, K::PrivateOption, K::PublicOption, @@ -762,7 +716,6 @@ mod tests { K::RepoUnarchived, K::RequireUpToDate, K::RequiredApprovals, - K::RestrictPushDesc, K::RestrictPushTitle, K::Role, K::RoleAdminDesc, @@ -773,7 +726,6 @@ mod tests { K::RoleUpdated, K::RoleWriteDesc, K::RequiredChecks, - K::RequiredChecksHelp, K::RecentContexts, K::RuleChangesShort, K::RuleNoExtra, @@ -790,7 +742,7 @@ mod tests { K::Secrets, K::SecretsHelp, K::SectionChecks, - K::SectionMerging, + K::SectionPullRequests, K::SectionPattern, K::SectionPushes, K::SettingsNavLabel, diff --git a/crates/forge-web/src/pages/repo.rs b/crates/forge-web/src/pages/repo.rs index 4a3fb98..72bdeaf 100644 --- a/crates/forge-web/src/pages/repo.rs +++ b/crates/forge-web/src/pages/repo.rs @@ -160,6 +160,8 @@ pub async fn repo_head( parts.push(SubPart::text(description.as_str())); } parts.push(SubPart::text(vis)); + parts.push(SubPart::text(watch_count)); + parts.push(SubPart::text(fork_count)); if let Some((source_owner, source_name)) = forked_from { parts.push(SubPart::link( format!("{} {source_owner}/{source_name}", g::t(lang, K::ForkedFrom)), @@ -202,19 +204,9 @@ pub async fn repo_head( } - + if let Some((action, csrf, level)) = watch_control { + watch_form(lang: lang, action: action, csrf: csrf, level: level, watchers: watchers) + } } else if private { (vis) } diff --git a/crates/forge-web/src/pages/repo_settings.rs b/crates/forge-web/src/pages/repo_settings.rs index edbc576..d580ac4 100644 --- a/crates/forge-web/src/pages/repo_settings.rs +++ b/crates/forge-web/src/pages/repo_settings.rs @@ -532,10 +532,11 @@ struct RuleCard { draft: RuleDraft, } -/// The rule list: a line per rule, then a muted line for the default branch when no rule covers it, -/// then the New rule line last. A rule opens in place with its rule's values, and the rule whose -/// draft has an error opens with the draft instead. The New rule line opens with the draft when no -/// rule takes it. The rows share one `name`, so opening one closes the rest. +/// The rule list: a line per rule with its summary and an Edit word. The last line is the add line: +/// when no rule covers the default branch it also names that branch as protected by default, and +/// the add line opens the add form, prefilled with the default branch. A rule opens in place with its +/// rule's values, and the rule whose draft has an error opens with the draft instead. The add line +/// opens with the draft when no rule takes it. The rows share one `name`, so opening one closes the rest. #[component] async fn branch_rule_cards( lang: Lang, @@ -560,6 +561,7 @@ async fn branch_rule_cards( (pill.text.as_str()) } + (g::t(lang, K::EditRule))
branch_rule_form(lang: lang, csrf: csrf.clone(), save_action: save_action.clone(), @@ -568,15 +570,13 @@ async fn branch_rule_cards(
} - if builtin_row { -
- (default_branch.as_str()) - (g::t(lang, K::BuiltinRowText)) -
- }
- "+ "(g::t(lang, K::NewRule)) + if builtin_row { + (default_branch.as_str())" "(g::t(lang, K::BuiltinRowText))" · "(g::t(lang, K::AddRule)) + } else { + (g::t(lang, K::AddRule)) + }
branch_rule_form(lang: lang, csrf: csrf.clone(), save_action: save_action.clone(), @@ -584,14 +584,15 @@ async fn branch_rule_cards( draft: new_draft, contexts: contexts.clone())
-

(passkeys::s(lang, "Pick a rule to edit it.", "Düzenlemek için bir kural seç."))

}) } -/// The rule form: the pattern, the pushes and merging switches, and the checks, with the save action -/// under them. Saving an existing pattern updates its rule. An existing rule also gets a Remove -/// action, a confirm_act sibling of the rule form, because forms cannot nest. +/// The rule form: the pattern (a new rule only), two groups of toggles, and the approvals and checks, +/// with the actions in one row under the form. The Pull requests group hides while Only through +/// pull requests is off, unless the rule already keeps a pull request setting, so a saved setting is +/// never hidden. The actions sit outside the form and submit it by its id, because forms cannot nest; +/// an existing rule's Remove action is a confirm_act beside them, on the same row. #[component] async fn branch_rule_form( lang: Lang, @@ -615,118 +616,109 @@ async fn branch_rule_form( error, is_new: _, } = draft; + // A pull request setting that is not the default keeps its group in view while the switch is off. + let pr_saved = !matches!(required_approvals.trim(), "" | "0") + || block_on_changes_requested + || require_up_to_date + || require_merge_queue + || !required_checks.trim().is_empty(); + let pr_class = if pr_saved { "rule-pr rule-pr-set" } else { "rule-pr" }; // Field ids are per rule, so two open rule forms never share an id. let prefix = match &rule_id { Some(id) => format!("rule-{id}"), None => "rule-new".to_owned(), }; + let form_id = format!("{prefix}-form"); let pattern_id = format!("{prefix}-pattern"); let approvals_id = format!("{prefix}-approvals"); let checks_id = format!("{prefix}-checks"); Ok(view! { -
- if let Some(message) = error { - alert(message: message.as_str()) - } - - // An existing rule's pattern is fixed: this form only changes what the rule does. A - // different pattern is a new rule, added from the New rule line. - if rule_id.is_some() { - - -
- (g::t(lang, K::BranchPattern)) - (pattern.as_str()) -

(passkeys::s(lang, "For another branch, add a new rule.", "Başka bir dal için yeni bir kural ekle."))

-
- } else { -
- - -

(g::t(lang, K::PatternHelpA))"*"(g::t(lang, K::PatternHelpB))"**"(g::t(lang, K::PatternHelpC))"/"(g::t(lang, K::PatternHelpD))

-
- } - // Each group is a field: its name in the label column, its boxes in the control column, each - // box with its note beside it. -
- (g::t(lang, K::SectionPushes)) -
-
- - (g::t(lang, K::ForcePushDesc)) -
-
- - (g::t(lang, K::DeletionDesc)) +
+ + if let Some(message) = error { + alert(message: message.as_str()) + } + + // An existing rule's pattern is fixed: this form only changes what the rule does. A + // different pattern is a new rule, added from the Add rule line. + if rule_id.is_some() { + + + } else { +
+ + +

(g::t(lang, K::PatternHelp))

-
- - (g::t(lang, K::RestrictPushDesc)) + } +
+

(g::t(lang, K::SectionPushes))

+
+
+ + + +
-
-
- - -

(g::t(lang, K::ApprovalsHelp))

-
-
- (g::t(lang, K::SectionMerging)) -
- - -
- - (mq::t(lang, mq::K::RequireMergeQueueHint)) +
+

(g::t(lang, K::SectionPullRequests))

+
+ +
-
-
-
- - -

(g::t(lang, K::RequiredChecksHelp))

- if !contexts.is_empty() { -
- (g::t(lang, K::RecentContexts)) - for context in contexts.iter() { - +
+
+ + + +
+
+
+ + + if !contexts.is_empty() { +
+ (g::t(lang, K::RecentContexts)) + for context in contexts.iter() { + + } +
}
- } -
-
+
+ +
if rule_id.is_some() { - + } else { - + } + if let Some(id) = &rule_id { + confirm_act(lang: lang, label: g::t(lang, K::RemoveRule), action: delete_action.as_str(), csrf: csrf.as_str(), + fields: vec![("rule_id".to_owned(), id.clone())]) + }
- - if let Some(id) = &rule_id { -
- confirm_act(lang: lang, label: g::t(lang, K::RemoveRule), action: delete_action.as_str(), csrf: csrf.as_str(), - fields: vec![("rule_id".to_owned(), id.clone())]) -
- } +
}) } diff --git a/docs/ui-language.md b/docs/ui-language.md index 6b39938..142638a 100644 --- a/docs/ui-language.md +++ b/docs/ui-language.md @@ -80,7 +80,10 @@ no `margin-left:auto`, no `justify-content:space-between`, no second column at t - **Time range**: every log has a When filter (Any time, Last hour, Last 24 hours, Last 7 days, Last 30 days, Today, Dates…). Dates… shows From and To day fields in the viewer's timezone, and the tools row starts with the count of entries that match, so "how many sign-ins last week" is one glance. -- **Tool**: `.act`, a word in the accent's ink (14px, 600, radius 12), never the dim colour of a hint. `.act.danger` for destructive. This is what goes in +- **Tool**: `.act`, a word in the accent's ink (14px, 600, radius 12), never the dim colour of a hint. + A topic's own action, standing alone under its heading in `.sec > .acts` or right in the `.sec` + (Rename repository, Transfer repository), takes the small soft pill (32px, like Star) instead, + red-worded when dangerous. On a line of facts a tool stays a word. `.act.danger` for destructive. This is what goes in tools rows, in rows and in `.acts`. - `reveal(label, id, open)`: a tool that opens its form in place. `open` when a form came back with an error. In a `.fields` form its word starts on the controls' edge. What should not be one click away diff --git a/scripts/audit/seed.py b/scripts/audit/seed.py index 0faa175..98705ee 100755 --- a/scripts/audit/seed.py +++ b/scripts/audit/seed.py @@ -515,6 +515,12 @@ def _(): seed["hook_id"] = m.group(1) if m and m.group(1) != "new" else None +@step("branch rule") +def _(): + admin.post(f"{R}/settings/branches", {"pattern": "release/*", "restrict_push": "on", + "required_approvals": "2", "required_checks": "ci/test"}) + + @step("secret") def _(): admin.post(f"{R}/settings/secrets", {"name": "DEPLOY_KEY", "value": "hunter2"}) diff --git a/style/_min_menus.scss b/style/_min_menus.scss index 293fd99..ddbb22e 100644 --- a/style/_min_menus.scss +++ b/style/_min_menus.scss @@ -72,7 +72,6 @@ // Actions moved left, so their menus open rightward from them and stay in the window. .watch-menu > .menu-list, -.head-more-list, .pins-menu > .pop-panel, .pins-menu > .menu-list, .clone > .menu-list, @@ -100,21 +99,6 @@ max-width: none; } - // The watch menu opens inside the fixed More panel: it stays in the panel's flow. - .head-more .watch-control, - .head-more .watch-menu { - display: block; - width: 100%; - } - - .head-more .watch-menu > .menu-list { - position: static !important; - width: 100%; - min-width: 0; - max-width: 100%; - box-shadow: none; - } - .line .val { flex-wrap: wrap; min-width: 0; diff --git a/style/_one.scss b/style/_one.scss index 890cb3d..06b73b4 100644 --- a/style/_one.scss +++ b/style/_one.scss @@ -3645,3 +3645,43 @@ details.log-group { font-size: 15px; line-height: 22px; } + +// A topic's own action, standing alone under its heading (Rename repository, Transfer repository, +// Regenerate codes), is a small soft pill like Star, not a word: it is the thing the topic is for. +// Tools on a line of facts stay words. A dangerous one keeps its red word on the pill. +.sec > .acts > details.reveal > summary.act, +.sec > .acts > :is(a.act, button.act), +.sec > .acts > form.act-form > button.act, +.sec > :is(a.act, button.act), +.sec > details > summary.act, +.sec > form > button.act:only-of-type { + height: var(--control-sm); + margin-left: 0; + padding: 0 14px; + border-radius: 15px; + background: var(--surface-2); + color: var(--text); + font-size: 13px; + font-weight: 600; + + &:hover { + background: color-mix(in oklab, var(--surface-2) 88%, var(--text)); + color: var(--text); + } + + &.danger, + &.danger:hover { + background: var(--danger-bg); + color: var(--bad); + } + + &.quiet { + color: var(--muted); + } +} + +// Pills keep their own edge, so a row of them starts on the topic's text edge. +.sec > .acts:has(> details.reveal > summary.act, > a.act, > button.act, > form.act-form > button.act) { + margin-left: 0; + gap: 8px; +} diff --git a/style/_one_admin.scss b/style/_one_admin.scss index cde74ed..d357792 100644 --- a/style/_one_admin.scss +++ b/style/_one_admin.scss @@ -306,3 +306,94 @@ $repo: 'main:has(> section.repo-head .tab.active[href$="/settings"])'; border-bottom: 0; } } + +// Branch rules. The form has two groups, Pushes and Pull requests, each with a heading and its +// fields stacked. Its options are toggles: the checkbox itself is drawn as a switch, so it stays the +// control for the keyboard and the label, and its focus ring shows. +#{$repo} .rule-section, +#{$repo} .rule-pr { + display: flex; + flex-direction: column; + gap: 6px; + min-width: 0; +} + +#{$repo} .rule-head { + margin: 12px 0 0; + font-size: 14px; + font-weight: 600; + color: var(--muted); +} + +#{$repo} .branch-rule-form label.switch { + align-items: center; + gap: 12px; + cursor: pointer; + font-weight: 400; + + > input[type="checkbox"] { + position: relative; + flex: none; + appearance: none; + width: 36px; + height: 20px; + margin: 0; + border: 0; + border-radius: 10px; + background: var(--surface-2); + box-shadow: inset 0 0 0 1.5px var(--border-strong); + transition: background 0.15s; + + &::after { + content: ""; + position: absolute; + top: 3px; + left: 3px; + width: 14px; + height: 14px; + border-radius: 50%; + background: var(--muted); + transition: transform 0.15s, background 0.15s; + } + + &:checked { + background: var(--accent); + box-shadow: none; + + &::after { + transform: translateX(16px); + background: var(--surface); + } + } + + &:focus-visible { + outline: 2px solid var(--focus); + outline-offset: 2px; + } + } +} + +// Pull requests show only while the rule is restricted to pull requests, live as its switch is ticked. +// A rule that already keeps a pull request setting keeps the group in view, so no saved value is hidden. +#{$repo} .branch-rule-form:has(input[name="restrict_push"]:not(:checked)) .rule-pr:not(.rule-pr-set) { + display: none; +} + +// The actions sit under the form on its control column, one row: Save or Add, Cancel, and Remove rule. +#{$repo} .rule-edit { + --label-w: 130px; +} + +#{$repo} .rule-acts { + align-items: center; + margin-left: calc(var(--label-w) + 16px); + + @media (max-width: 700px) { + margin-left: 0; + } +} + +// The recently seen checks start on the input's edge, in one line under it. +#{$repo} .recent-checks { + margin-left: 0; +} diff --git a/style/_one_shell.scss b/style/_one_shell.scss index f1ae159..755ef8c 100644 --- a/style/_one_shell.scss +++ b/style/_one_shell.scss @@ -131,31 +131,6 @@ a > .ref-chip, border: 0; } -// Repo actions panel on a phone: one fixed panel inside the window, its watch options inside it. -@media (max-width: 899px) { - .head-more-list { - position: fixed !important; - left: 16px !important; - right: 16px !important; - top: auto; - width: auto; - min-width: 0; - max-width: none; - } - - .head-more-list .watch-menu, - .head-more-list .watch-control { - width: 100%; - min-width: 0; - } - - .head-more-list .watch-menu > summary { - width: 100%; - max-width: 100%; - box-sizing: border-box; - } -} - // Watch options are menu rows: the name only. The longer description stays for screen readers. .watch-list .watch-option-desc { position: absolute; @@ -166,8 +141,8 @@ a > .ref-chip, white-space: nowrap; } -// The watch menu's button is a soft shape like every other, and inside the repo's "…" panel it is -// one of that panel's rows. Its options are menu rows too: 34px, the check before the name. +// The watch menu's button is a soft shape like every other action beside a title (the +// `.head-title` pill rule below). Its options are menu rows: 34px, the check before the name. .watch-menu > summary { height: var(--control-h); padding: 0 30px 0 14px; @@ -177,15 +152,18 @@ a > .ref-chip, font-size: 15px; } -.head-more-list .watch-menu > summary { - height: 34px; - padding: 0 30px 0 12px; - border-radius: 12px; - background: none; - font-size: 14px; +// Beside a repo title, the watch button is one of the head's pills: the same height, radius, fill, +// and 600 text as Star and Fork. The caret keeps its place at the end. +.head-title > .watch-control .watch-menu > summary { + box-sizing: border-box; + padding: 0 30px 0 18px; + font-size: 15px; + font-weight: 600; + line-height: 1; + color: var(--text); &:hover { - background: var(--surface-2); + background: color-mix(in oklab, var(--surface-2) 88%, var(--text)); } } @@ -211,42 +189,6 @@ a > .ref-chip, } } -// The counts in the repo's "…" panel sit on its rows' inset, as quiet rows of their own. -.head-more-list > .hint, -.head-more-list .watch-control > .hint { - display: flex; - align-items: center; - height: 30px; - margin: 0; - padding: 0 12px; - font-size: 13px; -} - -.head-more-list .watch-menu > summary { - justify-content: flex-start; -} - -// Inside the "…" panel the watch options open in place under their row, never as a second panel. -.head-more .watch-control, -.head-more .watch-menu { - display: block; - width: 100%; -} - -.head-more .watch-menu > .menu-list { - position: static !important; - width: 100%; - min-width: 0; - max-width: 100%; - padding: 0 0 4px; - box-shadow: none !important; - background: none !important; -} - -.head-more-list { - min-width: 220px; -} - .watch-list button.watch-option { justify-content: flex-start; text-align: left; @@ -257,3 +199,16 @@ a > .ref-chip, background: var(--surface-2); font-weight: 600; } + +// In the head the watcher count is in the line under the title, so the watch pill stands alone. +.head-title > .watch-control > .hint { + display: none; +} + +// On a phone the watch pill is its eye and chevron, so it shares the title's line with Star; its +// level stays in the summary's label. +@media (max-width: 700px) { + .head-title > .watch-control .watch-menu > summary > span { + display: none; + } +}