qtlpvpwrzqynmerged#2
initial commit again
Mcrates/df-web/assets/app.css+59−0
| @@ −669,6 +669,65 @@ | |||
| 669 | 669 | color: var(--text-dim); | |
| 670 | 670 | } | |
| 671 | 671 | ||
| 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 | + | ||
| 672 | 731 | footer { | |
| 673 | 732 | border-top: 1px solid var(--border); | |
| 674 | 733 | margin-top: 48px; | |
Mcrates/df-web/src/routes/repo.rs+1−0
| @@ −52,6 +52,7 @@ | |||
| 52 | 52 | v::empty_repo( | |
| 53 | 53 | &state.config.https_clone_url(&ctx.owner, &ctx.repo.name), | |
| 54 | 54 | &state.config.ssh_clone_url(&ctx.owner, &ctx.repo.name), | |
| 55 | + | &ctx.repo.default_bookmark, | |
| 55 | 56 | ) | |
| 56 | 57 | } else { | |
| 57 | 58 | let rev_label = ctx.repo.default_bookmark.clone(); | |
Mcrates/df-web/src/views/repo.rs+41−12
| @@ −47,7 +47,7 @@ | |||
| 47 | 47 | } | |
| 48 | 48 | ||
| 49 | 49 | /// Clone instructions, shown on an empty repository. | |
| 50 | − | pub fn empty_repo(https: &str, ssh: &str) -> Markup { | |
| 50 | + | pub fn empty_repo(https: &str, ssh: &str, default_bookmark: &str) -> Markup { | |
| 51 | 51 | html! { | |
| 52 | 52 | div .panel { | |
| 53 | 53 | h2 { "Push your first change" } | |
| @@ −55,19 +55,48 @@ | |||
| 55 | 55 | "This repository is empty. Push to it with " code { "jj" } " or " code { "git" } "." | |
| 56 | 56 | } | |
| 57 | 57 | ||
| 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"; | |
| 60 | 61 | ||
| 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 | + | } | |
| 63 | 66 | ||
| 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 | + | } | |
| 71 | 100 | } | |
| 72 | 101 | } | |
| 73 | 102 | } | |