{{ message }}
Repository navigation
conversation-activity-filter - Turn into svelte component
#9675
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
11 commits
Select commit
Hold shift + click to select a range
fb6bae3
Extract conversation activity filter menu to Svelte component
Copilot d46321f
Polish extracted conversation activity filter menu classes
Copilot d834eab
Refactor conversation activity filter state syncing
Copilot bd67b1a
Polish conversation activity filter sync naming
Copilot f79b77d
Clarify conversation activity filter parent sync
Copilot 0587966
format
fregante fad8b5f
Conflicts
fregante 34c5b9a
Move conversation filter UI state into Svelte
Copilot d0b20a6
Clarify conversation filter button state
Copilot d666a48
Format
fregante 44f409a
Further cleanups
fregante 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| <script lang="ts"> | ||
| import CheckIcon from 'octicons-plain-react/Check'; | ||
| import EyeIcon from 'octicons-plain-react/Eye'; | ||
| import EyeClosedIcon from 'octicons-plain-react/EyeClosed'; | ||
| import TriangleDownIcon from 'octicons-plain-react/TriangleDown'; | ||
|
|
||
| import {type State, states} from '../helpers/conversation-activity-filter.js'; | ||
| import DomChef from '../helpers/dom-chef.svelte'; | ||
| import {isSmallDevice} from '../helpers/dom-utils.js'; | ||
|
|
||
| type Props = { | ||
| state: State; | ||
| onStateChange: (_value: State) => void; | ||
| withMargin?: boolean; | ||
| }; | ||
|
|
||
| let { | ||
| state, | ||
| onStateChange, | ||
| withMargin = false, | ||
| }: Props = $props(); | ||
|
|
||
| const baseId = crypto.randomUUID(); | ||
|
|
||
| export function syncStateFromParent(targetState: State): void { | ||
| state = targetState; | ||
| } | ||
|
|
||
| function selectState(targetState: State): void { | ||
| state = targetState; | ||
| onStateChange(targetState); | ||
| } | ||
| </script> | ||
|
|
||
| <action-menu | ||
| class={`d-inline-block position-relative lh-condensed-ultra v-align-middle ${ | ||
| withMargin ? 'ml-2' : '' | ||
| }`} | ||
| data-select-variant="single" | ||
| > | ||
| <focus-group direction="vertical" mnemonics retain> | ||
| <button | ||
| id={`${baseId}-button`} | ||
| popovertarget={`${baseId}-overlay`} | ||
| aria-controls={`${baseId}-list`} | ||
| aria-haspopup="true" | ||
| type="button" | ||
| class="Button--small Button color-fg-muted p-0 tmp-p-0" | ||
| > | ||
| <span class="Button-content"> | ||
| <span | ||
| class="Button-visual Button-leadingVisual" | ||
| class:mr-0={state === 'showAll' || state === 'hideAllNoise'} | ||
| > | ||
| <DomChef as={EyeIcon} hidden={state !== 'showAll'} /> | ||
| <DomChef | ||
| as={EyeClosedIcon} | ||
| hidden={state === 'showAll'} | ||
| class="color-fg-danger" | ||
| /> | ||
| </span> | ||
| <span class="Button-label lh-condensed-ultra"> | ||
| <span | ||
| hidden={state !== 'hideEvents'} | ||
| class="v-align-text-top color-fg-danger" | ||
| >events</span> | ||
| </span> | ||
| <span class="Button-visual Button-trailingVisual"> | ||
| <DomChef as={TriangleDownIcon} /> | ||
| </span> | ||
| </span> | ||
| </button> | ||
| <anchored-position | ||
| id={`${baseId}-overlay`} | ||
| data-target="action-menu.overlay" | ||
| anchor={`${baseId}-button`} | ||
| align="start" | ||
| side="outside-bottom" | ||
| anchor-offset="normal" | ||
| popover="auto" | ||
| > | ||
| <div class="Overlay Overlay--size-small-portrait"> | ||
| <div class="Overlay-body Overlay-body--paddingNone"> | ||
| <action-list> | ||
| <ul | ||
| id={`${baseId}-list`} | ||
| aria-labelledby={`${baseId}-button`} | ||
| role="menu" | ||
| class="ActionListWrap--inset ActionListWrap" | ||
| > | ||
| {#each Object.entries(states) as [itemState, label] (itemState)} | ||
| <li | ||
| data-targets="action-list.items" | ||
| role="none" | ||
| class="ActionListItem" | ||
| > | ||
| <button | ||
| data-state={itemState} | ||
| id={`item-${crypto.randomUUID()}`} | ||
| type="button" | ||
| role="menuitemradio" | ||
| class="ActionListContent" | ||
| aria-checked={`${itemState === state}`} | ||
| onclick={() => { | ||
| selectState(itemState as State); | ||
| }} | ||
| > | ||
| <span | ||
| class="ActionListItem-visual ActionListItem-action--leading" | ||
| > | ||
| <DomChef | ||
| as={CheckIcon} | ||
| class="ActionListItem-singleSelectCheckmark" | ||
| /> | ||
| </span> | ||
| <span class="ActionListItem-label"> | ||
| {label} | ||
| </span> | ||
| </button> | ||
| </li> | ||
| {/each} | ||
| </ul> | ||
| </action-list> | ||
| </div> | ||
| {#if !isSmallDevice()} | ||
| <div class="Overlay-footer Overlay-footer--divided py-2 tmp-py-2"> | ||
| <span class="color-fg-muted"> | ||
| Press <kbd>h</kbd> to cycle through filters, | ||
| <br /> | ||
| even when the dropdown is closed | ||
| </span> | ||
| </div> | ||
| {/if} | ||
| </div> | ||
| </anchored-position> | ||
| </focus-group> | ||
| </action-menu> | ||
Oops, something went wrong.
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.
You can’t perform that action at this time.

Uh oh!
There was an error while loading. Please reload this page.