Jump to…
qtlpvpwrzqynmerged#2

initial commit again

3 files+101−12
Collapse all
Comparingv1 against its parent
Mcrates/df-web/assets/app.css+59−0
@@ −669,6 +669,65 @@
669669 color: var(--text-dim);
670670}
671671
672+/* Protocol toggle (HTTPS/SSH clone instructions). Two radios drive which
673+ panel shows via a sibling selector — no script needed, so the choice works
674+ identically with JavaScript on or off. */
675+.proto-toggle {
676+ margin-top: 14px;
677+}
678+
679+.proto-toggle input[type="radio"] {
680+ position: absolute;
681+ opacity: 0;
682+ pointer-events: none;
683+}
684+
685+.proto-tabs {
686+ display: inline-flex;
687+ overflow: hidden;
688+ border: 1px solid var(--border);
689+ border-radius: var(--radius);
690+}
691+
692+.proto-tab {
693+ padding: 3px 12px;
694+ font-size: var(--text-xs);
695+ font-weight: 500;
696+ color: var(--text-dim);
697+ cursor: pointer;
698+ user-select: none;
699+}
700+
701+.proto-tab + .proto-tab {
702+ border-left: 1px solid var(--border);
703+}
704+
705+.proto-tab:hover {
706+ background: var(--surface-raised);
707+ color: var(--text);
708+}
709+
710+#proto-https:focus-visible ~ .proto-tabs label[for="proto-https"],
711+#proto-ssh:focus-visible ~ .proto-tabs label[for="proto-ssh"] {
712+ outline: 2px solid var(--brand);
713+ outline-offset: 2px;
714+}
715+
716+.proto-panel {
717+ display: none;
718+}
719+
720+#proto-https:checked ~ #panel-https,
721+#proto-ssh:checked ~ #panel-ssh {
722+ display: block;
723+}
724+
725+#proto-https:checked ~ .proto-tabs label[for="proto-https"],
726+#proto-ssh:checked ~ .proto-tabs label[for="proto-ssh"] {
727+ background: var(--brand);
728+ color: var(--brand-ink);
729+}
730+
672731footer {
673732 border-top: 1px solid var(--border);
674733 margin-top: 48px;
Mcrates/df-web/src/routes/repo.rs+1−0
@@ −52,6 +52,7 @@
5252 v::empty_repo(
5353 &state.config.https_clone_url(&ctx.owner, &ctx.repo.name),
5454 &state.config.ssh_clone_url(&ctx.owner, &ctx.repo.name),
55+ &ctx.repo.default_bookmark,
5556 )
5657 } else {
5758 let rev_label = ctx.repo.default_bookmark.clone();
Mcrates/df-web/src/views/repo.rs+41−12
@@ −47,7 +47,7 @@
4747}
4848
4949/// Clone instructions, shown on an empty repository.
50pub fn empty_repo(https: &str, ssh: &str) -> Markup {
50+pub fn empty_repo(https: &str, ssh: &str, default_bookmark: &str) -> Markup {
5151 html! {
5252 div .panel {
5353 h2 { "Push your first change" }
@@ −55,19 +55,48 @@
5555 "This repository is empty. Push to it with " code { "jj" } " or " code { "git" } "."
5656 }
5757
58 p .label-condensed style="margin-top:18px" { "Clone over HTTPS" }
59 div .clone-box { code { "jj git clone " (https) } }
58+ div .proto-toggle {
59+ input type="radio" name="clone-protocol" id="proto-https" checked;
60+ input type="radio" name="clone-protocol" id="proto-ssh";
6061
61 p .label-condensed style="margin-top:14px" { "Clone over SSH" }
62 div .clone-box { code { "jj git clone " (ssh) } }
62+ div .proto-tabs role="tablist" aria-label="Protocol" {
63+ label .proto-tab for="proto-https" { "HTTPS" }
64+ label .proto-tab for="proto-ssh" { "SSH" }
65+ }
6366
64 p .label-condensed style="margin-top:14px" { "Push an existing repository" }
65 div .clone-box {
66 code { "jj git remote add origin " (https) " && jj git push -b main" }
67 }
68 p .hint {
69 "Over HTTPS, authenticate with your handle and a personal access token from "
70 a href="/settings" { "settings" } "."
67+ div .proto-panel #panel-https {
68+ p .label-condensed style="margin-top:14px" { "Clone" }
69+ div .clone-box { code { "jj git clone " (https) } }
70+
71+ p .label-condensed style="margin-top:14px" { "Push an existing repository" }
72+ div .clone-box {
73+ code {
74+ "jj git remote add origin " (https)
75+ " && jj git push -b " (default_bookmark)
76+ }
77+ }
78+ p .hint {
79+ "Authenticate with your handle and a personal access token from "
80+ a href="/settings" { "settings" } "."
81+ }
82+ }
83+
84+ div .proto-panel #panel-ssh {
85+ p .label-condensed style="margin-top:14px" { "Clone" }
86+ div .clone-box { code { "jj git clone " (ssh) } }
87+
88+ p .label-condensed style="margin-top:14px" { "Push an existing repository" }
89+ div .clone-box {
90+ code {
91+ "jj git remote add origin " (ssh)
92+ " && jj git push -b " (default_bookmark)
93+ }
94+ }
95+ p .hint {
96+ "Authenticate with an SSH key added in "
97+ a href="/settings" { "settings" } "."
98+ }
99+ }
71100 }
72101 }
73102 }