diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-20 22:59:09 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2025-08-18 17:03:21 +1000 |
| commit | 4558ed9d6cbc59229cd56cc7a6c36b1df0b8199a (patch) | |
| tree | 24b27334ed8dc3cbcdc6cca9def75bca176c8764 /Pages/Component | |
| parent | d7bc8b58f750c1a5c629915ed2097e477d204a67 (diff) | |
NSFW tagging and tag editing
Diffstat (limited to 'Pages/Component')
| -rw-r--r-- | Pages/Component/MediaTagTable.razor | 7 | ||||
| -rw-r--r-- | Pages/Component/Switch.razor | 15 | ||||
| -rw-r--r-- | Pages/Component/Switch.razor.css | 25 |
3 files changed, 47 insertions, 0 deletions
diff --git a/Pages/Component/MediaTagTable.razor b/Pages/Component/MediaTagTable.razor index 278304d..ce42e48 100644 --- a/Pages/Component/MediaTagTable.razor +++ b/Pages/Component/MediaTagTable.razor @@ -28,6 +28,8 @@ <td> @if(!e.isImplicit) { <a href="javascript:;" @onclick=@(() => Delete(e.tagDef))>Delete</a> + } else { + <a href="javascript:;" @onclick=@(() => MakeExplicit(e.tagDef))>Make Explicit</a> } </td> </tr> @@ -60,4 +62,9 @@ .Where(e => e.tagDefinition.Source == TagSource.UserTag) .ToArray(); } + + private void MakeExplicit(TagDefinition tagDef) { + tagService.AddTag(Media, tagDef); + Refresh(); + } } diff --git a/Pages/Component/Switch.razor b/Pages/Component/Switch.razor new file mode 100644 index 0000000..ffb3543 --- /dev/null +++ b/Pages/Component/Switch.razor @@ -0,0 +1,15 @@ +<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/> + +<label> + <input + type="checkbox" + @onchange=@(e => OnToggle.InvokeAsync((e.Value as bool?) ?? false)) + hidden/> + <div class="switch-outer"> + <div class="switch-inner"/> + </div> +</label> + +@code { + public EventCallback<bool> OnToggle { get; set; } +} diff --git a/Pages/Component/Switch.razor.css b/Pages/Component/Switch.razor.css new file mode 100644 index 0000000..6b1f5d5 --- /dev/null +++ b/Pages/Component/Switch.razor.css @@ -0,0 +1,25 @@ +div.switch-outer { + background: var(--col-switch-bg); + border-radius: 20px; + border: 1px solid var(--col-switch-fg); + cursor: pointer; + height: 20px; + transition: background 0.1s linear; + width: 40px; +} + +div.switch-inner { + background: var(--col-switch-fg); + border-radius: 20px; + height: 20px; + transition: margin-left 0.1s linear; + width: 20px; +} + +input:checked + div.switch-outer { + background: var(--col-switch-bg-hl); +} + +input:checked + div.switch-outer > div.switch-inner { + margin-left: 20px; +} |
