Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit ba25ebb

Browse files
fix: improved borders and added links to snippet/cookbook view page
1 parent abf0a67 commit ba25ebb

File tree

4 files changed

+44
-8
lines changed

4 files changed

+44
-8
lines changed

src/renderer/components/CookbookTable/CookbookTable.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Link,
1212
} from '@chakra-ui/react';
1313
import { UsersIcon, Logos } from '@codiga/components';
14+
import { useNavigate } from 'react-router-dom';
1415

1516
import { getCookbookUrl, getGroupUrl } from '../../utils/urlUtils';
1617
import { AssistantCookbook } from '../../types/assistantTypes';
@@ -37,8 +38,17 @@ type CookbookTableProps = {
3738
};
3839

3940
export default function CookbookTable({ cookbooks, page }: CookbookTableProps) {
41+
const navigate = useNavigate();
42+
4043
return (
41-
<Box w="full" h="full" overflow="hidden">
44+
<Box
45+
w="full"
46+
h="full"
47+
overflow="hidden"
48+
border="1px"
49+
borderColor="neutral.50"
50+
_dark={{ borderColor: 'base.onyx' }}
51+
>
4252
<TableContainer h="full" overflowY="scroll" overflowX="scroll">
4353
<Table variant="simple">
4454
<Tbody>
@@ -47,14 +57,15 @@ export default function CookbookTable({ cookbooks, page }: CookbookTableProps) {
4757
<Tr
4858
key={cookbook.id}
4959
p="space_16"
50-
border="1px"
60+
borderBottom="1px"
5161
borderColor="neutral.50"
5262
bg="neutral.0"
5363
_dark={{ bg: 'neutral.100', borderColor: 'base.onyx' }}
5464
_hover={{
5565
bg: 'neutral.25',
5666
_dark: { bg: 'base.onyx' },
5767
}}
68+
onClick={() => navigate(`/view-cookbook/${cookbook.id}`)}
5869
>
5970
<Td>
6071
<Flex alignItems="center" gap="space_8">

src/renderer/components/CookbookTable/CookbookTableLoading.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ const Td = (props: TableCellProps) => (
1616
export default function CookbookTableLoading() {
1717
return (
1818
<Box w="full" h="full" overflow="hidden">
19-
<TableContainer h="full" overflowY="scroll" overflowX="scroll">
19+
<TableContainer
20+
h="full"
21+
overflowY="scroll"
22+
overflowX="scroll"
23+
border="1px"
24+
borderColor="neutral.50"
25+
_dark={{ borderColor: 'base.onyx' }}
26+
>
2027
<Table variant="simple">
2128
<Tbody>
2229
{[1, 2, 3, 4, 5, 6, 7].map((num, i) => (
2330
<Tr
2431
key={`loading-${num + i}`}
2532
p="space_16"
26-
border="1px"
33+
borderBottom="1px"
2734
borderColor="neutral.50"
2835
bg="neutral.0"
2936
_dark={{ bg: 'neutral.100', borderColor: 'base.onyx' }}

src/renderer/components/SnippetTable/SnippetTable.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Link,
1212
} from '@chakra-ui/react';
1313
import { Logo, UsersIcon, Tags } from '@codiga/components';
14+
import { useNavigate } from 'react-router-dom';
1415

1516
import { getGroupUrl, getSnippetUrl } from '../../utils/urlUtils';
1617
import { AssistantRecipeWithStats } from '../../types/assistantTypes';
@@ -30,17 +31,27 @@ type SnippetTableProps = {
3031
};
3132

3233
export default function SnippetTable({ page, recipes }: SnippetTableProps) {
34+
const navigate = useNavigate();
35+
3336
return (
34-
<Box w="full" h="full" overflow="hidden">
37+
<Box
38+
w="full"
39+
h="full"
40+
overflow="hidden"
41+
border="1px"
42+
borderColor="neutral.50"
43+
_dark={{ borderColor: 'base.onyx' }}
44+
>
3545
<TableContainer h="full" overflowY="scroll" overflowX="scroll">
3646
<Table variant="simple">
3747
<Tbody>
3848
{recipes.map((recipe) => {
3949
return (
4050
<Tr
51+
onClick={() => navigate(`/view-snippet/${recipe.id}`)}
4152
key={recipe.id}
4253
p="space_16"
43-
border="1px"
54+
borderBottom="1px"
4455
borderColor="neutral.50"
4556
bg="neutral.0"
4657
_dark={{ bg: 'neutral.100', borderColor: 'base.onyx' }}

src/renderer/components/SnippetTable/SnippetTableLoading.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@ const Td = (props: TableCellProps) => (
1616
export default function SnippetTableLoading() {
1717
return (
1818
<Box w="full" h="full" overflow="hidden">
19-
<TableContainer h="full" overflowY="scroll" overflowX="scroll">
19+
<TableContainer
20+
h="full"
21+
overflowY="scroll"
22+
overflowX="scroll"
23+
border="1px"
24+
borderColor="neutral.50"
25+
_dark={{ borderColor: 'base.onyx' }}
26+
>
2027
<Table variant="simple">
2128
<Tbody>
2229
{[1, 2, 3, 4, 5, 6, 7].map((num, i) => (
2330
<Tr
2431
key={`loading-${num + i}`}
2532
p="space_16"
26-
border="1px"
33+
borderBottom="1px"
2734
borderColor="neutral.50"
2835
bg="neutral.0"
2936
_dark={{ bg: 'neutral.100', borderColor: 'base.onyx' }}

0 commit comments

Comments
 (0)