mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 06:10:44 +08:00
Remove not allowed cursor from Contributors and BranchSelector
Adds also HoverPopover tooltips, with some hints
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
export let autofocus: boolean = false;
|
||||
export let disabled: boolean = false;
|
||||
export let notAllowed: boolean = true;
|
||||
|
||||
export let styleFontFamily: string | undefined = undefined;
|
||||
export let stylePadding: string | undefined = undefined;
|
||||
@@ -40,9 +41,11 @@
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
cursor: not-allowed;
|
||||
color: var(--color-foreground-disabled);
|
||||
}
|
||||
button:disabled.not-allowed {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.small {
|
||||
height: var(--button-tiny-height);
|
||||
@@ -214,6 +217,7 @@
|
||||
on:mouseout
|
||||
on:mouseover
|
||||
class:disabled
|
||||
class:not-allowed={notAllowed}
|
||||
class:small={size === "small"}
|
||||
class:regular={size === "regular"}
|
||||
class:large={size === "large"}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
box-shadow: var(--elevation-low);
|
||||
position: relative;
|
||||
right: 1rem;
|
||||
z-index: 1;
|
||||
z-index: 10;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -138,7 +138,6 @@
|
||||
const preElement = node.parentElement as HTMLElement;
|
||||
const copyButton = document.createElement("radicle-clipboard");
|
||||
copyButton.setAttribute("text", node.textContent || "");
|
||||
copyButton.setAttribute("small", "");
|
||||
preElement.prepend(copyButton);
|
||||
|
||||
const className = Array.from(node.classList).find(name =>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import IconSmall from "@app/components/IconSmall.svelte";
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import HoverPopover from "@app/components/HoverPopover.svelte";
|
||||
|
||||
export let branches: Array<{ name: string; route: Route }>;
|
||||
export let node: BaseUrl;
|
||||
@@ -35,39 +36,66 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="branch" title="Current branch">
|
||||
<div class="branch">
|
||||
{#if selectedBranch}
|
||||
<Popover
|
||||
popoverPadding="0"
|
||||
popoverPositionTop="2.5rem"
|
||||
popoverBorderRadius="var(--border-radius-small)">
|
||||
<Button
|
||||
variant="outline"
|
||||
let:expanded
|
||||
let:toggle
|
||||
on:click={toggle}
|
||||
slot="toggle"
|
||||
styleBorderRadius="var(--border-radius-tiny) 0 0 var(--border-radius-tiny)"
|
||||
title="Change branch"
|
||||
disabled={hideDropdown}>
|
||||
<IconSmall name="branch" />
|
||||
<div class="identifier">{selectedBranch}</div>
|
||||
<IconSmall name={expanded ? "chevron-up" : "chevron-down"} />
|
||||
</Button>
|
||||
{#if hideDropdown}
|
||||
<HoverPopover popoverPositionLeft="0" popoverPositionTop="0.5rem">
|
||||
<Button
|
||||
ariaLabel="canonical-branch"
|
||||
variant="outline"
|
||||
styleBorderRadius="var(--border-radius-tiny) 0 0 var(--border-radius-tiny)"
|
||||
slot="toggle"
|
||||
disabled
|
||||
notAllowed={false}>
|
||||
<IconSmall name="branch" />
|
||||
<div class="identifier">{project.defaultBranch}</div>
|
||||
</Button>
|
||||
<div
|
||||
class="txt-small"
|
||||
style:padding="0.5rem 0.5rem 0.5rem 0.75rem"
|
||||
slot="popover">
|
||||
<div style:margin-bottom="1rem">
|
||||
You are currently browsing the canonical branch.
|
||||
</div>
|
||||
<div>If you want to browse a specific branch,</div>
|
||||
<div>you need to select the desired remote first.</div>
|
||||
</div>
|
||||
</HoverPopover>
|
||||
{:else}
|
||||
<Popover
|
||||
popoverPadding="0"
|
||||
popoverPositionTop="2.5rem"
|
||||
popoverBorderRadius="var(--border-radius-small)">
|
||||
<Button
|
||||
variant="outline"
|
||||
let:expanded
|
||||
let:toggle
|
||||
on:click={toggle}
|
||||
slot="toggle"
|
||||
styleBorderRadius="var(--border-radius-tiny) 0 0 var(--border-radius-tiny)"
|
||||
title="Change branch"
|
||||
disabled={hideDropdown}>
|
||||
<IconSmall name="branch" />
|
||||
<div class="identifier">{selectedBranch}</div>
|
||||
<IconSmall
|
||||
name={hideDropdown && expanded ? "chevron-up" : "chevron-down"} />
|
||||
</Button>
|
||||
|
||||
<DropdownList slot="popover" items={branches}>
|
||||
<svelte:fragment slot="item" let:item>
|
||||
<Link route={item.route} on:afterNavigate={() => closeFocused()}>
|
||||
<DropdownListItem selected={item.name === selectedBranch}>
|
||||
<div class="identifier">{item.name}</div>
|
||||
</DropdownListItem>
|
||||
</Link>
|
||||
</svelte:fragment>
|
||||
</DropdownList>
|
||||
</Popover>
|
||||
<DropdownList slot="popover" items={branches}>
|
||||
<svelte:fragment slot="item" let:item>
|
||||
<Link route={item.route} on:afterNavigate={() => closeFocused()}>
|
||||
<DropdownListItem selected={item.name === selectedBranch}>
|
||||
<div class="identifier">{item.name}</div>
|
||||
</DropdownListItem>
|
||||
</Link>
|
||||
</svelte:fragment>
|
||||
</DropdownList>
|
||||
</Popover>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<Button
|
||||
title="Current HEAD"
|
||||
variant={selectedBranch ? "gray" : "outline"}
|
||||
styleBorderRadius={selectedBranch
|
||||
? "0 var(--border-radius-tiny) var(--border-radius-tiny) 0"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import Link from "@app/components/Link.svelte";
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import Radio from "@app/components/Radio.svelte";
|
||||
import HoverPopover from "@app/components/HoverPopover.svelte";
|
||||
|
||||
export let node: BaseUrl;
|
||||
export let branches: Array<{ name: string; route: Route }>;
|
||||
@@ -100,11 +101,20 @@
|
||||
</Link>
|
||||
</Radio>
|
||||
|
||||
<Button disabled variant="outline">
|
||||
<IconSmall name="user" />
|
||||
<div>
|
||||
{tree.stats.contributors}
|
||||
{pluralize("contributor", tree.stats.contributors)}
|
||||
<HoverPopover popoverPositionLeft="0" popoverPositionTop="0.5rem">
|
||||
<Button disabled notAllowed={false} variant="outline" slot="toggle">
|
||||
<IconSmall name="user" />
|
||||
<div>
|
||||
{tree.stats.contributors}
|
||||
{pluralize("contributor", tree.stats.contributors)}
|
||||
</div>
|
||||
</Button>
|
||||
<div
|
||||
class="txt-small"
|
||||
style:padding="0.5rem 0.5rem 0.5rem 0.75rem"
|
||||
slot="popover">
|
||||
<div style:margin-bottom="1rem">Coming soon.</div>
|
||||
<div>Listing all contributors is not yet implemented.</div>
|
||||
</div>
|
||||
</Button>
|
||||
</HoverPopover>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user