Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed May 16, 2024
1 parent e2fdb1d commit 75b0df9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 19 deletions.
18 changes: 10 additions & 8 deletions packages/frontend/components/analytics/AnalyticsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import ErrorBoundary from "@/components/blocks/ErrorBoundary"
import { Card, Text } from "@mantine/core"

const AnalyticsCard = ({ title, children }) => (
<Card withBorder>
<Text c="dimmed" tt="uppercase" fw={700} fz="xs">
{title}
</Text>
<ErrorBoundary>{children}</ErrorBoundary>
</Card>
)
function AnalyticsCard({ title, children }) {
return (
<Card withBorder style={{ "&:children": { maxWidth: "100%" } }}>
<Text c="dimmed" tt="uppercase" fw={700} fz="xs">
{title}
</Text>
<ErrorBoundary>{children}</ErrorBoundary>
</Card>
)
}

export default AnalyticsCard
10 changes: 5 additions & 5 deletions packages/frontend/components/analytics/BarList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ type BarListProps = {

// A table of progress bars, with the progress value the proportion relative to the total
// and the second column the value of the bar
const BarList = ({
function BarList({
data,
columns,
customMetric,
filterZero = true,
}: BarListProps) => {
}: BarListProps) {
const dataColumns = columns.filter((col) => !col.bar && col.key)
const main = dataColumns.find((col) => col.main) || dataColumns[0]
const mainTotal = data.reduce((acc, item) => acc + (item[main.key] || 0), 0)
Expand Down Expand Up @@ -63,6 +63,8 @@ const BarList = ({
)}

<Table
layout="fixed"
w="100%"
cellPadding={0}
horizontalSpacing={0}
withRowBorders={false}
Expand Down Expand Up @@ -131,9 +133,7 @@ const BarList = ({
</Table.Td>
) : (
<Table.Td key={i}>
<Text>
{render ? render(item[key], item) : item[key]}
</Text>
{render ? render(item[key], item) : item[key]}
</Table.Td>
),
)}
Expand Down
33 changes: 29 additions & 4 deletions packages/frontend/pages/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import {
useRunsUsageByDay,
} from "@/utils/dataHooks"
import {
Anchor,
Center,
Container,
Group,
Loader,
SegmentedControl,
SimpleGrid,
Stack,
Text,
Title,
} from "@mantine/core"
import { useLocalStorage } from "@mantine/hooks"
Expand Down Expand Up @@ -132,10 +134,33 @@ export default function Analytics() {
columns={[
{
name: "User",
render: (u, row) => (
<Group my={-4} gap="sm">
<AppUserAvatar size={30} user={row} />
{formatAppUser(row)}
render: (_, user) => (
<Group
my={-4}
gap="sm"
wrap="nowrap"
style={{
overflow: "hidden",
textOverflow: "ellipsis",
}}
>
<AppUserAvatar size={30} user={user} />
<Text
style={{
overflow: "hidden",
textOverflow: "ellipsis",
}}
size="sm"
px="md"
>
<Anchor
c="inherit"
underline="never"
href={`/users/${user.id}`}
>
{formatAppUser(user)}
</Anchor>
</Text>
</Group>
),
},
Expand Down
13 changes: 11 additions & 2 deletions packages/frontend/pages/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,18 @@ const columns = [
const user = props.row.original

return (
<Group gap={8}>
<Group gap={8} wrap="nowrap">
<AppUserAvatar size={30} user={user} />
<Text fw={500}>{formatAppUser(user)}</Text>
<Text
style={{
overflow: "hidden",
textOverflow: "ellipsis",
}}
size="sm"
fw={500}
>
{formatAppUser(user)}
</Text>
</Group>
)
},
Expand Down

0 comments on commit 75b0df9

Please sign in to comment.