Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/grid/src/components/ProviderLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const ProviderLink = ({
>
<Avatar size={size} {...provider} />
<div className="flex-1 text-black">
<p className="font-mono">{provider.nickname || <ShipName name={provider.shipName} />}</p>
<div className="flex font-mono space-x-4">
<ShipName name={provider.shipName} />
<span className="text-gray-500">{provider.nickname}</span>
</div>
{provider.status && size === 'default' && <p className="font-normal">{provider.status}</p>}
</div>
</Link>
Expand Down
22 changes: 9 additions & 13 deletions pkg/grid/src/nav/Leap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ export const Leap = React.forwardRef(
(value: string) => {
const onlySymbols = !value.match(/[\w]/g);
const normValue = normalizeMatchString(value, onlySymbols);
return matches.find(
(m) =>
(m.display && normalizeMatchString(m.display, onlySymbols).startsWith(normValue)) ||
normalizeMatchString(m.value, onlySymbols).startsWith(normValue)
return matches.find((m) =>
normalizeMatchString(m.value, onlySymbols).startsWith(normValue)
);
},
[matches]
Expand Down Expand Up @@ -141,7 +139,7 @@ export const Leap = React.forwardRef(
const value = input.value.trim();
const isDeletion = (e.nativeEvent as InputEvent).inputType === 'deleteContentBackward';
const inputMatch = getMatch(value);
const matchValue = inputMatch?.display || inputMatch?.value;
const matchValue = inputMatch?.value;

if (matchValue && inputRef.current && !isDeletion) {
inputRef.current.value = matchValue;
Expand Down Expand Up @@ -207,18 +205,17 @@ export const Leap = React.forwardRef(

const currentIndex = selectedMatch
? matches.findIndex((m) => {
const matchValue = m.display || m.value;
const searchValue = selectedMatch.display || selectedMatch.value;
const matchValue = m.value;
const searchValue = selectedMatch.value;
return matchValue === searchValue;
})
: 0;
const unsafeIndex = e.key === 'ArrowUp' ? currentIndex - 1 : currentIndex + 1;
const index = (unsafeIndex + matches.length) % matches.length;

const newMatch = matches[index];
const matchValue = newMatch.display || newMatch.value;
useLeapStore.setState({
rawInput: matchValue,
rawInput: newMatch.value,
// searchInput: matchValue,
selectedMatch: newMatch
});
Expand All @@ -227,7 +224,6 @@ export const Leap = React.forwardRef(
[selection, rawInput, match, matches, selectedMatch]
);


return (
<div className="relative z-50 w-full">
<form
Expand Down Expand Up @@ -257,7 +253,7 @@ export const Leap = React.forwardRef(
type="text"
ref={inputRef}
placeholder={selection ? '' : 'Search'}
className="flex-1 w-full h-full px-2 h4 text-base rounded-full bg-transparent outline-none"
className="flex-1 w-full h-full px-2 text-base bg-transparent rounded-full outline-none h4"
value={rawInput}
onClick={toggleSearch}
onFocus={onFocus}
Expand All @@ -266,14 +262,14 @@ export const Leap = React.forwardRef(
autoComplete="off"
aria-autocomplete="both"
aria-controls={dropdown}
aria-activedescendant={selectedMatch?.display || selectedMatch?.value}
aria-activedescendant={selectedMatch?.value}
/>
) : null}
</form>
{menu === 'search' && (
<Link
to="/"
className="absolute top-1/2 right-2 flex-none circle-button w-8 h-8 text-gray-400 bg-gray-50 default-ring -translate-y-1/2"
className="absolute flex-none w-8 h-8 text-gray-400 top-1/2 right-2 circle-button bg-gray-50 default-ring -translate-y-1/2"
onClick={() => select(null)}
>
<Cross className="w-3 h-3 fill-current" />
Expand Down