Skip to content

Commit

Permalink
Merge pull request #22 from complexdatacollective/tooling
Browse files Browse the repository at this point in the history
Tooling
  • Loading branch information
jthrilly committed Mar 18, 2024
2 parents 2f8b2df + be868dd commit c4983f5
Show file tree
Hide file tree
Showing 921 changed files with 49,166 additions and 9,515 deletions.
6 changes: 4 additions & 2 deletions .vscode/settings.json
Expand Up @@ -3,5 +3,7 @@
{
"mode": "auto"
}
]
}
],
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
3 changes: 0 additions & 3 deletions apps/analytics-web/.eslintrc.js

This file was deleted.

22 changes: 11 additions & 11 deletions apps/analytics-web/app/_components/analytics/AnalyticsView.tsx
@@ -1,13 +1,13 @@
import { Card, CardHeader, CardContent } from "~/components/ui/card";
import EventsTable from "./EventsTable/EventsTable";
import TotalAppsCard from "./cards/TotalAppsCard";
import TotalInterviewsCompletedCard from "./cards/TotalInterviewsCompletedCard";
import TotalInterviewsStartedCard from "./cards/TotalInterviewsStartedCard";
import TotalProtocolsInstalledCard from "./cards/TotalProtocolsInstalledCard";
import RegionsTable from "./RegionsTable/RegionsTable";
import getEvents from "~/db/getEvents";
import TotalErrorsCard from "./cards/TotalErrorsCard";
import TotalDataExported from "./cards/TotalDataExported";
import { Card, CardHeader, CardContent } from '~/components/ui/card';
import EventsTable from './EventsTable/EventsTable';
import TotalAppsCard from './cards/TotalAppsCard';
import TotalInterviewsCompletedCard from './cards/TotalInterviewsCompletedCard';
import TotalInterviewsStartedCard from './cards/TotalInterviewsStartedCard';
import TotalProtocolsInstalledCard from './cards/TotalProtocolsInstalledCard';
import RegionsTable from './RegionsTable/RegionsTable';
import getEvents from '~/db/getEvents';
import TotalErrorsCard from './cards/TotalErrorsCard';
import TotalDataExported from './cards/TotalDataExported';

export default async function AnalyticsView() {
const events = await getEvents();
Expand All @@ -22,7 +22,7 @@ export default async function AnalyticsView() {
<TotalDataExported />
<TotalErrorsCard />
</div>
<div className="grid gap-4 lg:grid-cols-3 md:grid-cols-2 sm:grid-cols-1">
<div className="grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
<div className="lg:col-span-2">
<EventsTable events={events} />
</div>
Expand Down
@@ -1,21 +1,21 @@
"use client";
'use client';

import { ColumnDef } from "@tanstack/react-table";
import { type Dispatch, type SetStateAction } from "react";
import { DataTableColumnHeader } from "~/components/DataTable/column-header";
import { MetadataDialog } from "~/components/MetadataDialog";
import type { Event } from "~/db/getEvents";
import { type EventType } from "./EventsTable";
import { StackTraceDialog } from "./StackTraceDialog";
import TableFilter from "./TableFilter";
import { type ColumnDef } from '@tanstack/react-table';
import { type Dispatch, type SetStateAction } from 'react';
import { DataTableColumnHeader } from '~/components/DataTable/column-header';
import { MetadataDialog } from '~/components/MetadataDialog';
import type { Event } from '~/db/getEvents';
import { type EventType } from './EventsTable';
import { StackTraceDialog } from './StackTraceDialog';
import TableFilter from './TableFilter';

export const getColumns = (
eventTypes: EventType[],
setEventTypes: Dispatch<SetStateAction<EventType[]>>
setEventTypes: Dispatch<SetStateAction<EventType[]>>,
) => {
const columns: ColumnDef<Event>[] = [
{
accessorKey: "type",
accessorKey: 'type',
header: ({ column }) => (
<div className="flex space-x-4">
<TableFilter eventTypes={eventTypes} setEventTypes={setEventTypes} />
Expand All @@ -24,7 +24,7 @@ export const getColumns = (
),
},
{
accessorKey: "timestamp",
accessorKey: 'timestamp',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Timestamp" />
),
Expand All @@ -37,7 +37,7 @@ export const getColumns = (
},
},
{
accessorKey: "installationId",
accessorKey: 'installationId',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Installation Id" />
),
Expand All @@ -46,26 +46,26 @@ export const getColumns = (
},
},
{
accessorKey: "name",
accessorKey: 'name',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Name" />
),
},
{
accessorKey: "message",
accessorKey: 'message',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Message" />
),
},
{
accessorKey: "cause",
accessorKey: 'cause',
header: ({ column }) => (
<DataTableColumnHeader column={column} title="Cause" />
),
},
{
accessorKey: "stack",
header: "",
accessorKey: 'stack',
header: '',
cell: ({ row }) =>
row.original.stack && (
<div className="min-w-max">
Expand All @@ -74,8 +74,8 @@ export const getColumns = (
),
},
{
accessorKey: "metadata",
header: "",
accessorKey: 'metadata',
header: '',
cell: ({ row }) => {
return (
<div className="min-w-max">
Expand Down
@@ -1,10 +1,10 @@
"use client";
'use client';

import { useEffect, useMemo, useState } from "react";
import { DataTable } from "~/components/DataTable/data-table";
import ExportButton from "~/components/ExportButton";
import { Event } from "~/db/getEvents";
import { getColumns } from "./Columns";
import { useEffect, useMemo, useState } from 'react';
import { DataTable } from '~/components/DataTable/data-table';
import ExportButton from '~/components/ExportButton';
import { type Event } from '~/db/getEvents';
import { getColumns } from './Columns';

export type EventType = {
text: string;
Expand All @@ -17,7 +17,7 @@ export default function EventsTable({ events }: { events: Event[] }) {
useEffect(() => {
const eventTypesMap = new Map<string, EventType>();
events.forEach((event) =>
eventTypesMap.set(event.type, { text: event.type, isSelected: true })
eventTypesMap.set(event.type, { text: event.type, isSelected: true }),
);

setEventTypes([...Array.from(eventTypesMap.values())]);
Expand All @@ -33,7 +33,7 @@ export default function EventsTable({ events }: { events: Event[] }) {

return (
<div>
<div className="flex justify-between items-center mt-2">
<div className="mt-2 flex items-center justify-between">
<h2>Events</h2>
<ExportButton data={events} filename="events.csv" />
</div>
Expand Down
@@ -1,5 +1,5 @@
import { DialogButton } from "~/components/DialogButton";
import { Event } from "~/db/getEvents";
import { DialogButton } from '~/components/DialogButton';
import { type Event } from '~/db/getEvents';

export function StackTraceDialog({ error }: { error: Event }) {
return (
Expand Down
@@ -1,16 +1,16 @@
"use client";
'use client';

import { useState, type Dispatch, type SetStateAction } from "react";
import { Button } from "~/components/ui/button";
import { Checkbox } from "~/components/ui/checkbox";
import { useState, type Dispatch, type SetStateAction } from 'react';
import { Button } from '~/components/ui/button';
import { Checkbox } from '~/components/ui/checkbox';
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "~/components/ui/dropdown-menu";
import { type EventType } from "./EventsTable";
} from '~/components/ui/dropdown-menu';
import { type EventType } from './EventsTable';

type TableFilterProps = {
eventTypes: EventType[];
Expand All @@ -23,8 +23,8 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => {
const toggleOption = (option: string) => {
setOptions((prevState) =>
prevState.map((t) =>
t.text === option ? { ...t, isSelected: !t.isSelected } : t
)
t.text === option ? { ...t, isSelected: !t.isSelected } : t,
),
);
};

Expand All @@ -37,17 +37,21 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button className="text-sm" size={"sm"} variant="outline">
<Button className="text-sm" size={'sm'} variant="outline">
Type
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent className="w-52 ml-12">
<DropdownMenuContent className="ml-12 w-52">
<DropdownMenuLabel>Select events</DropdownMenuLabel>
<DropdownMenuSeparator />

<div className="space-y-3">
<label className="text-sm flex items-center gap-3 pl-2 transition-colors hover:bg-muted p-1 rounded-md">
<label
htmlFor="all-checkbox"
className="flex items-center gap-3 rounded-md p-1 pl-2 text-sm transition-colors hover:bg-muted"
>
<Checkbox
id="all-checkbox"
checked={isAllSelected}
onCheckedChange={() => toggleAllOptions(!isAllSelected)}
/>
Expand All @@ -58,7 +62,7 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => {
{options.map((option) => (
<label
key={option.text}
className="text-sm flex items-center gap-3 pl-2 transition-colors hover:bg-muted p-1 rounded-md"
className="flex items-center gap-3 rounded-md p-1 pl-2 text-sm transition-colors hover:bg-muted"
>
<Checkbox
checked={option.isSelected}
Expand All @@ -71,7 +75,7 @@ const TableFilter = ({ eventTypes, setEventTypes }: TableFilterProps) => {
<Button
onClick={() => setEventTypes(options)}
className="float-right"
size={"sm"}
size={'sm'}
>
Apply
</Button>
Expand Down
@@ -1,13 +1,13 @@
"use client";
import { ColumnDef } from "@tanstack/react-table";
import { RegionTotal } from "~/utils/getRegionsTotals";
'use client';
import { type ColumnDef } from '@tanstack/react-table';
import { type RegionTotal } from '~/utils/getRegionsTotals';
export const columns: ColumnDef<RegionTotal>[] = [
{
accessorKey: "country",
header: "Country",
accessorKey: 'country',
header: 'Country',
},
{
accessorKey: "total",
header: "Total",
accessorKey: 'total',
header: 'Total',
},
];
@@ -1,6 +1,6 @@
import { DataTable } from "~/components/DataTable/data-table";
import getRegionsTotals from "~/utils/getRegionsTotals";
import { columns } from "./Columns";
import { DataTable } from '~/components/DataTable/data-table';
import getRegionsTotals from '~/utils/getRegionsTotals';
import { columns } from './Columns';

export default async function ErrorsTable() {
const regionsTotals = await getRegionsTotals();
Expand Down
@@ -1,5 +1,5 @@
import { getTotalAppsSetup } from "~/utils/getTotalAppsSetup";
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalAppsSetup } from '~/utils/getTotalAppsSetup';
import { SummaryCard } from '~/components/SummaryCard';

const TotalAppsCard = async () => {
const totalAppsSetup = await getTotalAppsSetup();
Expand Down
@@ -1,5 +1,5 @@
import { getTotalInterviewsStarted } from "~/utils/getTotalInterviewsStarted";
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalInterviewsStarted } from '~/utils/getTotalInterviewsStarted';
import { SummaryCard } from '~/components/SummaryCard';

const TotalDataExported = async () => {
const totalInterviewsStarted = await getTotalInterviewsStarted();
Expand Down
@@ -1,5 +1,5 @@
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalErrors } from "~/utils/getTotalErrors";
import { SummaryCard } from '~/components/SummaryCard';
import { getTotalErrors } from '~/utils/getTotalErrors';

const TotalErrorsCard = async () => {
const totalErrors = await getTotalErrors();
Expand Down
@@ -1,5 +1,5 @@
import { getTotalInterviewsCompleted } from "~/utils/getTotalInterviewsCompleted";
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalInterviewsCompleted } from '~/utils/getTotalInterviewsCompleted';
import { SummaryCard } from '~/components/SummaryCard';

const TotalAppsCard = async () => {
const totalInterviewsCompleted = await getTotalInterviewsCompleted();
Expand Down
@@ -1,5 +1,5 @@
import { getTotalInterviewsStarted } from "~/utils/getTotalInterviewsStarted";
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalInterviewsStarted } from '~/utils/getTotalInterviewsStarted';
import { SummaryCard } from '~/components/SummaryCard';

const TotalInterviewsStartedCard = async () => {
const totalInterviewsStarted = await getTotalInterviewsStarted();
Expand Down
@@ -1,5 +1,5 @@
import { getTotalProtocolsInstalled } from "~/utils/getTotalProtocolsInstalled";
import { SummaryCard } from "~/components/SummaryCard";
import { getTotalProtocolsInstalled } from '~/utils/getTotalProtocolsInstalled';
import { SummaryCard } from '~/components/SummaryCard';

const TotalProtocolsInstalledCard = async () => {
const totalProtocolsInstalled = await getTotalProtocolsInstalled();
Expand Down
@@ -1,14 +1,14 @@
import { Button } from "~/components/ui/button";
import { Button } from '~/components/ui/button';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "~/components/ui/dialog";
import { Users as UsersIcon } from "lucide-react";
import VerifiedUsersTable from "./UsersTable/UsersTable";
} from '~/components/ui/dialog';
import { Users as UsersIcon } from 'lucide-react';
import VerifiedUsersTable from './UsersTable/UsersTable';

export default function UserManagementDialog() {
return (
Expand Down

0 comments on commit c4983f5

Please sign in to comment.