-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from complexdatacollective/biome
Biome
- Loading branch information
Showing
737 changed files
with
13,863 additions
and
51,912 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
name: Check for broken links | ||
|
||
on: deployment_status | ||
name: Check for Broken Links | ||
|
||
on: | ||
deployment_status | ||
jobs: | ||
linkinator: | ||
runs-on: ubuntu-latest | ||
if: ${{ startsWith(github.event.deployment_status.environment_url, 'https://documentation') && github.event.deployment_status.state == 'success' }} | ||
# Runs if the deployment environment starts with 'preview' and the deployment status is 'success', and if the url does not contain 'analytics' | ||
if: ${{ startsWith(github.event.deployment_status.environment, 'preview') && github.event.deployment_status.state == 'success' }} && !contains(github.event.deployment_status.environment_url, 'analytics') | ||
steps: | ||
- name: Run linkinator against deployment preview URL | ||
run: npx --yes linkinator ${{ github.event.deployment_status.environment_url}} -r | ||
- name: Checkout the repository | ||
uses: actions/checkout@v4 | ||
- name: Run dead-link-checker | ||
run: npx @jthrilly/dead-link-checker ${{ github.event.deployment_status.environment_url }} -v --yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Lint and Format | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
- name: Cache pnpm | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Run Biome | ||
run: pnpm biome check . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Dependency Update Tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install pnpm | ||
run: npm install -g pnpm | ||
- name: Cache pnpm | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
- name: Install dependencies | ||
run: pnpm install | ||
- name: Run All Tests | ||
run: pnpm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
], | ||
"typescript.tsdk": "./node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"cSpell.enableFiletypes": [ | ||
"mdx" | ||
], | ||
"cSpell.words": [ | ||
"netcanvas", | ||
"Tipbox" | ||
] | ||
} | ||
"typescript.tsdk": "./node_modules/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"cSpell.words": ["netcanvas", "Tipbox"], | ||
"editor.defaultFormatter": "biomejs.biome", | ||
"[typescriptreact]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "biomejs.biome" | ||
}, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "always", | ||
"source.fixAll": "always" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,31 @@ | ||
'use server'; | ||
"use server"; | ||
|
||
import { type EventInsertType, db } from '~/db/db'; | ||
import { eventsTable } from '~/db/schema'; | ||
import { type EventInsertType, db } from "~/db/db"; | ||
import { eventsTable } from "~/db/schema"; | ||
|
||
export async function getEvents() { | ||
try { | ||
const events = await db.query.eventsTable.findMany({ | ||
orderBy: (events, { desc }) => [desc(events.timestamp)], | ||
}); | ||
try { | ||
const events = await db.query.eventsTable.findMany({ | ||
orderBy: (events, { desc }) => [desc(events.timestamp)], | ||
}); | ||
|
||
return events; | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.error('Error getting events', error); | ||
return []; | ||
} | ||
return events; | ||
} catch (error) { | ||
console.error("Error getting events", error); | ||
return []; | ||
} | ||
} | ||
|
||
type Events = Awaited<ReturnType<typeof getEvents>>; | ||
export type Event = Events[0]; | ||
|
||
export async function insertEvent(event: EventInsertType) { | ||
try { | ||
const insertedEvent = await db | ||
.insert(eventsTable) | ||
.values(event) | ||
.returning(); | ||
try { | ||
const insertedEvent = await db.insert(eventsTable).values(event).returning(); | ||
|
||
return { data: insertedEvent, error: null }; | ||
} catch (error) { | ||
// eslint-disable-next-line no-console | ||
console.error('Error inserting events', error); | ||
return { data: null, error: 'Error inserting events' }; | ||
} | ||
return { data: insertedEvent, error: null }; | ||
} catch (error) { | ||
console.error("Error inserting events", error); | ||
return { data: null, error: "Error inserting events" }; | ||
} | ||
} |
68 changes: 34 additions & 34 deletions
68
apps/analytics-web/app/_components/analytics/AnalyticsView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
import { getEvents } from '~/app/_actions/actions'; | ||
import { Card, CardContent, CardHeader } from '~/components/ui/card'; | ||
import EventsTable from './EventsTable/EventsTable'; | ||
import RegionsTable from './RegionsTable/RegionsTable'; | ||
import TotalAppsCard from './cards/TotalAppsCard'; | ||
import TotalDataExported from './cards/TotalDataExported'; | ||
import TotalErrorsCard from './cards/TotalErrorsCard'; | ||
import TotalInterviewsCompletedCard from './cards/TotalInterviewsCompletedCard'; | ||
import TotalInterviewsStartedCard from './cards/TotalInterviewsStartedCard'; | ||
import TotalProtocolsInstalledCard from './cards/TotalProtocolsInstalledCard'; | ||
import { getEvents } from "~/app/_actions/actions"; | ||
import { Card, CardContent, CardHeader } from "~/components/ui/card"; | ||
import EventsTable from "./EventsTable/EventsTable"; | ||
import RegionsTable from "./RegionsTable/RegionsTable"; | ||
import TotalAppsCard from "./cards/TotalAppsCard"; | ||
import TotalDataExported from "./cards/TotalDataExported"; | ||
import TotalErrorsCard from "./cards/TotalErrorsCard"; | ||
import TotalInterviewsCompletedCard from "./cards/TotalInterviewsCompletedCard"; | ||
import TotalInterviewsStartedCard from "./cards/TotalInterviewsStartedCard"; | ||
import TotalProtocolsInstalledCard from "./cards/TotalProtocolsInstalledCard"; | ||
|
||
export default async function AnalyticsView() { | ||
const events = await getEvents(); | ||
const events = await getEvents(); | ||
|
||
return ( | ||
<div className="space-y-4"> | ||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4"> | ||
<TotalAppsCard events={events} /> | ||
<TotalProtocolsInstalledCard events={events} /> | ||
<TotalInterviewsStartedCard events={events} /> | ||
<TotalInterviewsCompletedCard events={events} /> | ||
<TotalDataExported events={events} /> | ||
<TotalErrorsCard events={events} /> | ||
</div> | ||
<div className="grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"> | ||
<div className="lg:col-span-2"> | ||
<EventsTable /> | ||
</div> | ||
<Card className="h-fit"> | ||
<CardHeader>Regions</CardHeader> | ||
<CardContent> | ||
<RegionsTable events={events} /> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</div> | ||
); | ||
return ( | ||
<div className="space-y-4"> | ||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4"> | ||
<TotalAppsCard events={events} /> | ||
<TotalProtocolsInstalledCard events={events} /> | ||
<TotalInterviewsStartedCard events={events} /> | ||
<TotalInterviewsCompletedCard events={events} /> | ||
<TotalDataExported events={events} /> | ||
<TotalErrorsCard events={events} /> | ||
</div> | ||
<div className="grid gap-4 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3"> | ||
<div className="lg:col-span-2"> | ||
<EventsTable /> | ||
</div> | ||
<Card className="h-fit"> | ||
<CardHeader>Regions</CardHeader> | ||
<CardContent> | ||
<RegionsTable events={events} /> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.