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
module.exports = { | |
env: { | |
browser: true, | |
es2021: true, | |
}, | |
extends: [ | |
"react-app", | |
"react-app/jest", | |
"standard-with-typescript", | |
"plugin:react/recommended", |
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
import React, { useRef, useEffect, RefObject, forwardRef } from "react"; | |
interface FormProps { | |
onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void; | |
} | |
const Form = forwardRef<HTMLFormElement, FormProps>((props, ref) => { | |
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | |
event.preventDefault(); | |
console.log("Form submitted"); |
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
import HttpClient from 'whyfetch'; | |
const API_KEY = process.env.NEXT_PUBLIC_ASSEMBLY_API_KEY; | |
const ASSEMBLY_BASE_URL = 'https://api.assemblyai.com/v2'; | |
class Assembly { | |
private client: HttpClient; | |
constructor() { | |
this.client = new HttpClient(ASSEMBLY_BASE_URL, { |
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
import { type NotificationProps } from '@mantine/core'; | |
import { notifications } from '@mantine/notifications'; | |
import { IconCheck, IconInfoCircle, IconX } from '@tabler/icons-react'; | |
const toast = { | |
error: (message: string, options?: NotificationProps) => { | |
notifications.show({ | |
...options, | |
color: 'red', | |
icon: <IconX size="1.1rem" />, |
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
import { Button, Group, Paper, Stepper, Title, } from "@mantine/core"; | |
import { useForm } from "@mantine/form"; | |
import { useEffect, useMemo, useState } from "react"; | |
export default function DemoForm() { | |
// Initialize the root form using the useForm hook | |
const { | |
setValues: setFormValues, | |
setFieldValue, | |
values: formValues, |
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
test.describe('Upload Organization Logo', () => { | |
let fileChooserPromise: Promise<FileChooser>; | |
test.beforeEach(async ({ page }) => { | |
fileChooserPromise = page.waitForEvent('filechooser'); | |
await page | |
.getByRole('button', { name: 'Select Company Logo' }) | |
.click(); | |
}); |
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
test('Downloads report', async ({ page }) => { | |
const downloadPromise = page.waitForEvent('download'); | |
await page.getByRole('button', { name: 'Download Report' }).click(); | |
const download = await downloadPromise; | |
const expectedFileName = report.name + '.pdf'; | |
expect(download.suggestedFilename()).toBe(expectedFileName); |
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
// mock GET /organizations, to get the current company metadata | |
await page.route('**/dashboard/v1/company', (route) => { | |
apis.getCurrentCompany(route); | |
}); | |
// mock PUT /organizations, to update the company metadata | |
await page.route('**/dashboard/v1/company', (route) => { | |
apis.getCurrentCompany(route); | |
}); | |