-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
184 additions
and
234 deletions.
There are no files selected for viewing
This file contains 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,32 @@ | ||
import { css } from '@emotion/react' | ||
import { Flex, Text } from '@radix-ui/themes' | ||
import { ReactNode } from 'react' | ||
import grotIllustration from '@/assets/grot.svg' | ||
|
||
interface NoRequestsMessageProps { | ||
noRequestsMessage?: ReactNode | ||
} | ||
|
||
export function NoRequestsMessage({ | ||
noRequestsMessage = 'Your requests will appear here.', | ||
}: NoRequestsMessageProps) { | ||
return ( | ||
<Flex direction="column" align="center" gap="4" pt="8"> | ||
<img | ||
src={grotIllustration} | ||
role="presentation" | ||
css={css` | ||
width: 50%; | ||
max-width: 300px; | ||
`} | ||
/> | ||
{typeof noRequestsMessage === 'string' ? ( | ||
<Text color="gray" size="1"> | ||
{noRequestsMessage} | ||
</Text> | ||
) : ( | ||
noRequestsMessage | ||
)} | ||
</Flex> | ||
) | ||
} |
This file contains 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 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 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 @@ | ||
export const DEFAULT_GROUP_NAME = 'Default group' |
This file contains 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,19 @@ | ||
import { DEFAULT_GROUP_NAME } from '@/constants' | ||
import { ProxyData } from '@/types' | ||
import { useMemo } from 'react' | ||
|
||
/** Returns an array of unique group names from the given proxy data */ | ||
export function useProxyDataGroups(proxyData: ProxyData[]) { | ||
return useMemo(() => { | ||
const names = new Set( | ||
proxyData.map((data) => data.group ?? DEFAULT_GROUP_NAME) | ||
) | ||
|
||
return Array.from(names).map((name) => { | ||
return { | ||
id: name, | ||
name, | ||
} | ||
}) | ||
}, [proxyData]) | ||
} |
This file contains 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 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 was deleted.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { DEFAULT_GROUP_NAME } from '@/constants' | ||
import { ProxyData } from '@/types' | ||
import { groupBy } from 'lodash-es' | ||
|
||
export function groupProxyData(requests: ProxyData[]) { | ||
return groupBy(requests, (item) => item.group || 'Default') | ||
return groupBy(requests, (item) => item.group || DEFAULT_GROUP_NAME) | ||
} |
This file contains 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 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
Oops, something went wrong.