mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 18:45:36 +01:00
Added SettingsContext.
This commit is contained in:
parent
3f657d97b2
commit
4fca98d25d
22 changed files with 106 additions and 83 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { ReactNode, useContext } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { Button, Text, Icon, Icons, GridTable, GridColumn, useBreakpoint } from 'react-basics';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import useUser from 'components/hooks/useUser';
|
||||
import SettingsContext from '../SettingsContext';
|
||||
|
||||
export interface WebsitesTableProps {
|
||||
data: any[];
|
||||
|
|
@ -24,6 +25,7 @@ export function WebsitesTable({
|
|||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useUser();
|
||||
const breakpoint = useBreakpoint();
|
||||
const { settingsUrl, websitesUrl } = useContext(SettingsContext);
|
||||
|
||||
return (
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
|
|
@ -50,7 +52,7 @@ export function WebsitesTable({
|
|||
return (
|
||||
<>
|
||||
{allowEdit && (!showTeam || ownerId === user.id) && (
|
||||
<Link href={`/settings/websites/${id}`}>
|
||||
<Link href={`${settingsUrl}/${id}`}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.Edit />
|
||||
|
|
@ -60,7 +62,7 @@ export function WebsitesTable({
|
|||
</Link>
|
||||
)}
|
||||
{allowView && (
|
||||
<Link href={`/websites/${id}`}>
|
||||
<Link href={`${websitesUrl}/${id}`}>
|
||||
<Button>
|
||||
<Icon>
|
||||
<Icons.External />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue