Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Brian Cao 2023-10-12 13:15:01 -07:00
commit 92d16d8937
11 changed files with 67 additions and 100 deletions

View File

@ -97,7 +97,7 @@
"node-fetch": "^3.2.8",
"npm-run-all": "^4.1.5",
"react": "^18.2.0",
"react-basics": "^0.100.0",
"react-basics": "^0.102.0",
"react-beautiful-dnd": "^13.1.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.4",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -16,7 +16,11 @@
min-height: 50vh;
}
@media only screen and (max-width: 768px) {
@media only screen and (max-width: 992px) {
.layout {
grid-template-columns: 1fr;
}
.menu {
display: none;
}

View File

@ -6,6 +6,7 @@ import useApi from 'components/hooks/useApi';
import DataTable from 'components/common/DataTable';
import useFilterQuery from 'components/hooks/useFilterQuery';
import useCache from 'store/cache';
import { useBreakpoint } from 'react-basics';
export interface WebsitesDataTableProps {
allowEdit?: boolean;
@ -45,6 +46,7 @@ export function WebsitesDataTable({
children,
}: WebsitesDataTableProps) {
const queryResult = useWebsites({ includeTeams, onlyTeams });
const breakpoint = useBreakpoint();
return (
<DataTable queryResult={queryResult}>
@ -55,6 +57,7 @@ export function WebsitesDataTable({
showActions={showActions}
allowEdit={allowEdit}
allowView={allowView}
cardMode={['xs', 'sm', 'md'].includes(breakpoint)}
>
{children}
</WebsitesTable>

View File

@ -9,13 +9,14 @@ export function WebsitesTable({
showActions,
allowEdit,
allowView,
cardMode,
children,
}) {
const { formatMessage, labels } = useMessages();
const { user } = useUser();
return (
<GridTable data={data}>
<GridTable data={data} cardMode={cardMode}>
<GridColumn name="name" label={formatMessage(labels.name)} />
<GridColumn name="domain" label={formatMessage(labels.domain)} />
{showTeam && (
@ -28,39 +29,41 @@ export function WebsitesTable({
{row => row.user.username}
</GridColumn>
)}
<GridColumn name="action" label=" " alignment="end">
{row => {
const {
id,
user: { id: ownerId },
} = row;
{showActions && (
<GridColumn name="action" label=" " alignment="end">
{row => {
const {
id,
user: { id: ownerId },
} = row;
return (
<>
{showActions && allowEdit && (!showTeam || ownerId === user.id) && (
<Link href={`/settings/websites/${id}`}>
<Button>
<Icon>
<Icons.Edit />
</Icon>
<Text>{formatMessage(labels.edit)}</Text>
</Button>
</Link>
)}
{showActions && allowView && (
<Link href={`/websites/${id}`}>
<Button>
<Icon>
<Icons.External />
</Icon>
<Text>{formatMessage(labels.view)}</Text>
</Button>
</Link>
)}
</>
);
}}
</GridColumn>
return (
<>
{allowEdit && (!showTeam || ownerId === user.id) && (
<Link href={`/settings/websites/${id}`}>
<Button>
<Icon>
<Icons.Edit />
</Icon>
<Text>{formatMessage(labels.edit)}</Text>
</Button>
</Link>
)}
{allowView && (
<Link href={`/websites/${id}`}>
<Button>
<Icon>
<Icons.External />
</Icon>
<Text>{formatMessage(labels.view)}</Text>
</Button>
</Link>
)}
</>
);
}}
</GridColumn>
)}
{children}
</GridTable>
);

View File

@ -19,7 +19,9 @@
.body {
display: flex;
flex-direction: column;
position: relative;
overflow-x: auto;
}
.body td {
@ -27,6 +29,12 @@
gap: 10px;
min-height: 70px;
align-items: center;
min-width: min-content;
}
.body > div > div > div {
display: flex;
gap: 10px;
}
.pager {

View File

@ -1,4 +1,4 @@
import { useTransition, animated } from 'react-spring';
import { useTransition, animated } from '@react-spring/web';
import { Button, Icon } from 'react-basics';
import useTheme from 'components/hooks/useTheme';
import Icons from 'components/icons';

View File

@ -1,6 +1,6 @@
import useMeasure from 'react-use-measure';
import { FixedSizeList } from 'react-window';
import { useSpring, animated, config } from 'react-spring';
import { useSpring, animated, config } from '@react-spring/web';
import classNames from 'classnames';
import Empty from 'components/common/Empty';
import { formatLongNumber } from 'lib/format';

View File

@ -1,5 +1,5 @@
import classNames from 'classnames';
import { useSpring, animated } from 'react-spring';
import { useSpring, animated } from '@react-spring/web';
import { formatNumber } from 'lib/format';
import styles from './MetricCard.module.css';

View File

@ -43,10 +43,11 @@
};
const getPath = url => {
if (url.substring(0, 4) === 'http') {
return '/' + url.split('/').splice(3).join('/');
try {
return new URL(url).pathname;
} catch (e) {
return url;
}
return url;
};
const getPayload = () => ({

View File

@ -2027,7 +2027,7 @@
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/core@~9.7.1", "@react-spring/core@~9.7.3":
"@react-spring/core@~9.7.3":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/core/-/core-9.7.3.tgz#60056bcb397f2c4f371c6c9a5f882db77ae90095"
integrity sha512-IqFdPVf3ZOC1Cx7+M0cXf4odNLxDC+n7IN3MDcVCTIOSBfqEcBebSv+vlY5AhM0zw05PDbjKrNmBpzv/AqpjnQ==
@ -2036,26 +2036,6 @@
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/konva@~9.7.1":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/konva/-/konva-9.7.3.tgz#16bd29dd4860a99e960a72987c8bcfc828b22119"
integrity sha512-R9sY6SiPGYqz1383P5qppg5z57YfChVknOC1UxxaGxpw+WiZa8fZ4zmZobslrw+os3/+HAXZv8O+EvU/nQpf7g==
dependencies:
"@react-spring/animated" "~9.7.3"
"@react-spring/core" "~9.7.3"
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/native@~9.7.1":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/native/-/native-9.7.3.tgz#ee38d7c23482cfb4916c9b3c021de2995a4f553a"
integrity sha512-4mpxX3FuEBCUT6ae2fjhxcJW6bhr2FBwFf274eXB7n+U30Gdg8Wo2qYwcUnmiAA0S3dvP8vLTazx3+CYWFShnA==
dependencies:
"@react-spring/animated" "~9.7.3"
"@react-spring/core" "~9.7.3"
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/shared@~9.7.3":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/shared/-/shared-9.7.3.tgz#4cf29797847c689912aec4e62e34c99a4d5d9e53"
@ -2063,22 +2043,12 @@
dependencies:
"@react-spring/types" "~9.7.3"
"@react-spring/three@~9.7.1":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/three/-/three-9.7.3.tgz#4358a0c4640efe2972c4f7d0f7cd4efe927471c1"
integrity sha512-Q1p512CqUlmMK8UMBF/Rj79qndhOWq4XUTayxMP9S892jiXzWQuj+xC3Xvm59DP/D4JXusXpxxqfgoH+hmOktA==
dependencies:
"@react-spring/animated" "~9.7.3"
"@react-spring/core" "~9.7.3"
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/types@~9.7.3":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/types/-/types-9.7.3.tgz#ea78fd447cbc2612c1f5d55852e3c331e8172a0b"
integrity sha512-Kpx/fQ/ZFX31OtlqVEFfgaD1ACzul4NksrvIgYfIFq9JpDHFwQkMVZ10tbo0FU/grje4rcL4EIrjekl3kYwgWw==
"@react-spring/web@^9.7.3", "@react-spring/web@~9.7.1":
"@react-spring/web@^9.7.3":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/web/-/web-9.7.3.tgz#d9f4e17fec259f1d65495a19502ada4f5b57fa3d"
integrity sha512-BXt6BpS9aJL/QdVqEIX9YoUy8CE6TJrU0mNCqSoxdXlIeNcEBWOfIyE6B14ENNsyQKS3wOWkiJfco0tCr/9tUg==
@ -2088,16 +2058,6 @@
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@react-spring/zdog@~9.7.1":
version "9.7.3"
resolved "https://registry.yarnpkg.com/@react-spring/zdog/-/zdog-9.7.3.tgz#8ccc7316f6d3460ed244d9e3f60de9b4c4a848ac"
integrity sha512-L+yK/1PvNi9n8cldiJ309k4LdxcPkeWE0W18l1zrP1IBIyd5NB5EPA8DMsGr9gtNnnIujtEzZk+4JIOjT8u/tw==
dependencies:
"@react-spring/animated" "~9.7.3"
"@react-spring/core" "~9.7.3"
"@react-spring/shared" "~9.7.3"
"@react-spring/types" "~9.7.3"
"@redis/bloom@1.1.0":
version "1.1.0"
resolved "https://registry.npmjs.org/@redis/bloom/-/bloom-1.1.0.tgz"
@ -7606,15 +7566,15 @@ rc@^1.2.7:
minimist "^1.2.0"
strip-json-comments "~2.0.1"
react-basics@^0.100.0:
version "0.100.0"
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.100.0.tgz#14a36769af89f3e01641997f897e4073f16f5035"
integrity sha512-ET6DX/FYAcjGRauBE4jwqwVpd/hKmA2Nu/fi1dakwsv17hkyV5FEAhdWhQAxJX3VnaCH//QysN8+ae12KuNA9g==
react-basics@^0.102.0:
version "0.102.0"
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.102.0.tgz#61dbc837963facb2d409044046eb55f7c689411e"
integrity sha512-MhLHgjVnOwdm1YX1Lwkyg37kPCTOk+b3NXWGORlh4dJThq/qq/s0lF09yqEq09Gye5yyTDbeNDPXlkXIPtadog==
dependencies:
"@react-spring/web" "^9.7.3"
classnames "^2.3.1"
date-fns "^2.29.3"
react-hook-form "^7.34.2"
react-spring "^9.5.5"
react-window "^1.8.6"
react-beautiful-dnd@^13.1.0:
@ -7698,18 +7658,6 @@ react-simple-maps@^2.3.0:
d3-zoom "^2.0.0"
topojson-client "^3.1.0"
react-spring@^9.5.5:
version "9.7.1"
resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-9.7.1.tgz#8acfed700823490a4d9d4cf131c5fea12d1aaa93"
integrity sha512-o2+r2DNQDVEuefiz33ZF76DPd/gLq3kbdObJmllGF2IUfv2W6x+ZP0gR97QYCSR4QLbmOl1mPKUBbI+FJdys2Q==
dependencies:
"@react-spring/core" "~9.7.1"
"@react-spring/konva" "~9.7.1"
"@react-spring/native" "~9.7.1"
"@react-spring/three" "~9.7.1"
"@react-spring/web" "~9.7.1"
"@react-spring/zdog" "~9.7.1"
react-use-measure@^2.0.4:
version "2.1.1"
resolved "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.1.tgz"