Repository navigation
feat(web): refresh the dashboard's visual design #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* Design tokens, adapted from the deployex dashboard's shared token file so the two keep a matching | ||
| palette. Plain CSS custom properties, no Tailwind/daisyUI syntax - edit the values here and every | ||
| class built on them (in the @theme block in app.css) picks it up, without touching component files. | ||
|
|
||
| The light values apply on :root; .dark overrides them, matching this project's own dark-mode | ||
| mechanism (a `dark` class toggled on <html> by the Themer hook), not deployex's `data-theme` attr. */ | ||
|
|
||
| :root { | ||
| --dx-base-100: oklch(98.6% 0.006 85); | ||
| --dx-base-200: oklch(95% 0.011 80); | ||
| --dx-base-300: oklch(88.5% 0.016 75); | ||
| --dx-base-content: oklch(23% 0.014 60); | ||
| --dx-muted: color-mix(in oklch, var(--dx-base-content) 66%, var(--dx-base-100)); | ||
|
|
||
| --dx-primary: oklch(70% 0.213 47.604); | ||
| --dx-primary-content: oklch(98% 0.016 73.684); | ||
| --dx-primary-text: oklch(50% 0.16 42); | ||
| --dx-secondary: oklch(52% 0.02 60); | ||
| --dx-secondary-content: oklch(98.6% 0.006 85); | ||
| --dx-neutral: oklch(44% 0.017 60); | ||
| --dx-neutral-content: oklch(98.6% 0.006 85); | ||
|
|
||
| --dx-info: oklch(62% 0.214 259.815); | ||
| --dx-info-content: oklch(97% 0.014 254.604); | ||
| --dx-info-text: oklch(47% 0.17 260); | ||
| --dx-success: oklch(70% 0.14 182.503); | ||
| --dx-success-content: oklch(98% 0.014 180.72); | ||
| --dx-success-text: oklch(44% 0.09 182); | ||
| --dx-warning: oklch(66% 0.179 58.318); | ||
| --dx-warning-content: oklch(98% 0.022 95.277); | ||
| --dx-warning-text: oklch(47% 0.12 58); | ||
| --dx-error: oklch(58% 0.253 17.585); | ||
| --dx-error-content: oklch(96% 0.015 12.422); | ||
| --dx-error-text: oklch(48% 0.19 20); | ||
| } | ||
|
|
||
| .dark { | ||
| --dx-base-100: oklch(30.33% 0.016 252.42); | ||
| --dx-base-200: oklch(25.26% 0.014 253.1); | ||
| --dx-base-300: oklch(20.15% 0.012 254.09); | ||
| --dx-base-content: oklch(97.807% 0.029 256.847); | ||
| --dx-muted: color-mix(in oklch, var(--dx-base-content) 66%, var(--dx-base-100)); | ||
|
|
||
| --dx-primary: oklch(58% 0.233 277.117); | ||
| --dx-primary-content: oklch(96% 0.018 272.314); | ||
| --dx-primary-text: oklch(80% 0.11 277); | ||
| --dx-secondary: oklch(58% 0.233 277.117); | ||
| --dx-secondary-content: oklch(96% 0.018 272.314); | ||
| --dx-neutral: oklch(37% 0.044 257.287); | ||
| --dx-neutral-content: oklch(98% 0.003 247.858); | ||
|
|
||
| --dx-info: oklch(58% 0.158 241.966); | ||
| --dx-info-content: oklch(97% 0.013 236.62); | ||
| --dx-info-text: oklch(82% 0.09 240); | ||
| --dx-success: oklch(60% 0.118 184.704); | ||
| --dx-success-content: oklch(98% 0.014 180.72); | ||
| --dx-success-text: oklch(82% 0.09 182); | ||
| --dx-warning: oklch(66% 0.179 58.318); | ||
| --dx-warning-content: oklch(98% 0.022 95.277); | ||
| --dx-warning-text: oklch(84% 0.12 72); | ||
| --dx-error: oklch(58% 0.253 17.585); | ||
| --dx-error-content: oklch(96% 0.015 12.422); | ||
| --dx-error-text: oklch(80% 0.12 20); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Ticks down to the timestamp in data-expires (ISO 8601), purely client-side so it doesn't need | ||
| // a server round-trip every second. The server re-renders data-expires whenever a new session | ||
| // starts, which this hook picks up via updated(). | ||
| const Countdown = { | ||
| mounted() { | ||
| this.tick(); | ||
| this.timer = setInterval(() => this.tick(), 1000); | ||
| }, | ||
|
|
||
| updated() { | ||
| this.tick(); | ||
| }, | ||
|
|
||
| destroyed() { | ||
| clearInterval(this.timer); | ||
| }, | ||
|
|
||
| tick() { | ||
| const expiresAt = new Date(this.el.dataset.expires).getTime(); | ||
| const remainingMs = expiresAt - Date.now(); | ||
| const remainingSeconds = Math.max(0, Math.ceil(remainingMs / 1000)); | ||
|
|
||
| this.el.textContent = `${remainingSeconds}s`; | ||
| }, | ||
| }; | ||
|
|
||
| export default Countdown; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| defmodule Observer.Web.Components.DetailsPanel do | ||
| @moduledoc """ | ||
| Bottom-docked panel that slides up to show the details of whatever row/identifier a page's | ||
| user just selected (an ETS table, a process, a port, ...), with collapse/expand/close controls. | ||
| Each page keeps its own selection state and event names; this component only renders the | ||
| shared chrome around whatever content the caller puts in its `inner_block` slot. | ||
| """ | ||
| use Phoenix.Component | ||
|
|
||
| alias Observer.Web.Components.Icons | ||
| alias Phoenix.LiveView.JS | ||
|
|
||
| attr :id, :string, required: true | ||
| attr :expand_id, :string, required: true | ||
| attr :collapse_id, :string, required: true | ||
| attr :close_id, :string, required: true | ||
| attr :collapsed, :boolean, required: true | ||
| attr :expanded, :boolean, required: true | ||
| attr :expand_event, :string, required: true | ||
| attr :collapse_event, :string, required: true | ||
| attr :close_event, :string, required: true | ||
|
|
||
| slot :title, required: true | ||
| slot :inner_block, required: true | ||
|
|
||
| def content(assigns) do | ||
| ~H""" | ||
| <div | ||
| id={@id} | ||
| phx-mounted={ | ||
| JS.transition( | ||
| {"transition-transform duration-300 ease-out", "translate-y-full", "translate-y-0"} | ||
| ) | ||
| } | ||
| class={[ | ||
| "fixed inset-x-0 bottom-0 z-30 flex flex-col bg-base-100 border-t border-base-300 shadow-2xl", | ||
| @expanded && "max-h-[92vh]", | ||
| !@expanded && "max-h-[70vh]" | ||
| ]} | ||
| > | ||
| <div class="flex items-center justify-between px-4 py-2 border-b border-base-300 shrink-0"> | ||
| <h2 class="text-sm font-semibold text-base-content"> | ||
| {render_slot(@title)} | ||
| </h2> | ||
| <div class="flex items-center gap-x-3"> | ||
| <button | ||
| :if={not @collapsed} | ||
| id={@expand_id} | ||
| type="button" | ||
| aria-label={if @expanded, do: "Shrink details panel", else: "Expand details panel"} | ||
| title={if @expanded, do: "Shrink", else: "Expand"} | ||
| phx-click={@expand_event} | ||
| class="inline-flex text-muted focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary focus:text-base-content transition ease-in-out duration-150" | ||
| > | ||
| <%= if @expanded do %> | ||
| <Icons.arrows_pointing_in class="w-5 h-5" /> | ||
| <% else %> | ||
| <Icons.arrows_pointing_out class="w-5 h-5" /> | ||
| <% end %> | ||
| </button> | ||
| <button | ||
| id={@collapse_id} | ||
| type="button" | ||
| aria-label={if @collapsed, do: "Restore details panel", else: "Minimize details panel"} | ||
| title={if @collapsed, do: "Restore", else: "Minimize"} | ||
| phx-click={@collapse_event} | ||
| class="inline-flex text-muted focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary focus:text-base-content transition ease-in-out duration-150" | ||
| > | ||
| <%= if @collapsed do %> | ||
| <Icons.chevron_up class="w-5 h-5" /> | ||
| <% else %> | ||
| <Icons.chevron_down class="w-5 h-5" /> | ||
| <% end %> | ||
| </button> | ||
| <button | ||
| id={@close_id} | ||
| type="button" | ||
| aria-label="Close details panel" | ||
| title="Close" | ||
| phx-click={@close_event} | ||
| class="inline-flex text-muted focus:outline-none focus:ring-1 focus:ring-primary focus:border-primary focus:text-base-content transition ease-in-out duration-150" | ||
| > | ||
| <Icons.x_mark class="w-5 h-5" /> | ||
| </button> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div :if={not @collapsed} class="overflow-y-auto"> | ||
| {render_slot(@inner_block)} | ||
| </div> | ||
| </div> | ||
| """ | ||
| end | ||
|
|
||
| @doc """ | ||
| Bottom padding for the page's root container, so the docked panel never overlaps the page's | ||
| own content. Sized to match the panel's own collapsed/expanded height. | ||
| """ | ||
| def padding_class(shown?, collapsed?, expanded?) | ||
| def padding_class(false, _collapsed?, _expanded?), do: nil | ||
| def padding_class(true, true, _expanded?), do: "pb-16" | ||
| def padding_class(true, false, true), do: "pb-[92vh]" | ||
| def padding_class(true, false, false), do: "pb-[70vh]" | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.