Skip to content

Commit

Permalink
fix: ESLINT
Browse files Browse the repository at this point in the history
  • Loading branch information
tefkah committed Nov 1, 2023
1 parent 83eeb6b commit 922e67b
Show file tree
Hide file tree
Showing 41 changed files with 426 additions and 478 deletions.
67 changes: 30 additions & 37 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,39 @@
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript", "airbnb", "airbnb-typescript", "next", "prettier"],
"rules": {
"prefer-arrow/prefer-arrow-functions": [
"error",
{
"disallowPrototype": true,
"singleReturnOnly": false,
"classPropertiesAllowed": false
}
],
"prefer-arrow-callback": [
"error",
{
"allowNamedFunctions": true
}
],
"func-style": [
"error",
"expression",
{
"allowArrowFunctions": true
}
],
// "prefer-arrow/prefer-arrow-functions": [
// "error",
// {
// "disallowPrototype": true,
// "singleReturnOnly": false,
// "classPropertiesAllowed": false
// }
// ],
// "prefer-arrow-callback": [
// "error",
// {
// "allowNamedFunctions": true
// }
// ],
// "func-style": [
// "error",
// "expression",
// {
// "allowArrowFunctions": true
// }
// ],

"react/prop-types": "off",
"import/prefer-default-export": "off",
"import/no-extraneous-dependencies": "off",
"import/extensions": [
"error",
"never",
{
"json": "always",
"svg": "always",
"css": "always"
}
],
"react/function-component-definition": [
2,
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
"import/extensions": 0,
// "react/function-component-definition": [
// 2,
// {
// "namedComponents": "arrow-function",
// "unnamedComponents": "arrow-function"
// }
// ],
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off"
}
Expand Down
8 changes: 6 additions & 2 deletions apps/trialanderror.org/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"next/core-web-vitals",
"../../.eslintrc.json"
],
"ignorePatterns": ["!**/*", ".next/**/*"],
"parserOptions": {
"project": "apps/trialanderror.org/tsconfig.*json"
},
"ignorePatterns": ["!**/*", ".next/**/*", "**/*jest.config.ts"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
Expand All @@ -23,7 +26,8 @@
}
],
"rules": {
"@next/next/no-html-link-for-pages": "off"
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-shadow": "off"
},
"env": {
"jest": true
Expand Down
20 changes: 9 additions & 11 deletions apps/trialanderror.org/src/app/[page]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ export default async function AboutPage({ params: { page } }: Props) {
<h1 className="-mt-10 text-4xl font-black text-blue-500 md:-mt-16 md:text-7xl">
{title}
</h1>
{block?.map((block) => {
return (
<div
className="prose"
key={block.id}
dangerouslySetInnerHTML={{
__html: block.body ?? '',
}}
/>
)
})}
{block?.map((b) => (
<div
className="prose"
key={b.id}
dangerouslySetInnerHTML={{
__html: b.body ?? '',
}}
/>
))}
</article>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions apps/trialanderror.org/src/app/about/ShittyScrollHack.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use client';
'use client'

import { useEffect } from 'react';
import { useEffect } from 'react'

export function ShittyScrollHack() {
useEffect(() => {
const hash = window.location.hash;
const { hash } = window.location
if (hash.length > 0) {
window.location.hash = '';
window.location.hash = hash;
window.location.hash = ''
window.location.hash = hash
}
});
})

return <></>;
return null
}
1 change: 0 additions & 1 deletion apps/trialanderror.org/src/app/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { getTeam } from '../team/page'
import { TeamMemberCard } from '../components/TeamMemberCard'
import { OurMission } from '../components/OurMission'
import { AboutUs } from '../components/AboutUs'
import { ShittyScrollHack } from './ShittyScrollHack'
import { createMetadata } from '../../utils/createMetadata'

export const revalidate = 3600 // revalidate every hour
Expand Down
4 changes: 1 addition & 3 deletions apps/trialanderror.org/src/app/components/AboutUs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { Frame } from './Frame'
import { growFadeIn } from '../../utils/motionPresets'

export function AboutUs() {
return (
<div className="relative min-h-screen w-screen">
return <div className="relative min-h-screen w-screen">
<Frame />
<motion.div
initial={{ opacity: 0 }}
Expand Down Expand Up @@ -55,5 +54,4 @@ export function AboutUs() {
</motion.div>
</motion.div>
</div>
)
}
1 change: 1 addition & 0 deletions apps/trialanderror.org/src/app/components/Analytics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use client'

import { Analytics } from '@vercel/analytics/react'

export function AnalyticsWrapper() {
Expand Down
63 changes: 34 additions & 29 deletions apps/trialanderror.org/src/app/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use client'
import { Card } from '../../server/mixed'

import Image from 'next/image'
import Link from 'next/link'
import { motion } from 'framer-motion'
import { format } from 'date-fns'
import type { Card as CardType } from '../../server/mixed'

function splitSentences(sentence: string) {
const regex = /[^.!?]+[.!?]/g
const matches = sentence.match(regex)
return matches ? matches.map((s) => s.trim()) : [sentence]
}
// function splitSentences(sentence: string) {
// const regex = /[^.!?]+[.!?]/g
// const matches = sentence.match(regex)
// return matches ? matches.map((s) => s.trim()) : [sentence]
// }

export function Card({ card, delay = 0 }: { card: Card; delay?: number }) {
export function Card({ card, delay = 0 }: { card: CardType; delay?: number }) {
const { title, type } = card

const titleWithoutAcronymsWithPeriods = title.replace(/([A-Z])\.([A-Z])\.?/g, '$1$2')
Expand All @@ -20,7 +21,6 @@ export function Card({ card, delay = 0 }: { card: Card; delay?: number }) {
const mainTitle = titleParts[1]?.replace(/[:.]/g, '')
const subTitle = titleParts.slice(2).join(' ')?.replace(/[:.]/g, '').trim()
const capitalizedSubTitle = subTitle.charAt(0).toUpperCase() + subTitle.slice(1)
const titleClass = subTitle ? 'text-2xl' : 'text-3xl'

return (
<motion.article
Expand All @@ -31,7 +31,7 @@ export function Card({ card, delay = 0 }: { card: Card; delay?: number }) {
x: 0,
transition: {
duration: 0.5,
delay: delay,
delay,
},
}}
viewport={{ once: true }}
Expand All @@ -54,7 +54,7 @@ export function Card({ card, delay = 0 }: { card: Card; delay?: number }) {
initial={{ y: 100, opacity: 0 }}
key={card.title}
className="group relative col-span-1 flex w-80 flex-col border-b-[6px] border-blue-500 bg-white md:w-96"
//className="hover:shadow-thick-3 group relative col-span-1 flex flex-col shadow-[0px_0px_0_#000] transition-all ease-in-out hover:-translate-x-2 hover:-translate-y-2"
// className="hover:shadow-thick-3 group relative col-span-1 flex flex-col shadow-[0px_0px_0_#000] transition-all ease-in-out hover:-translate-x-2 hover:-translate-y-2"
>
{card?.image?.url ? (
<Image
Expand Down Expand Up @@ -99,26 +99,31 @@ export function Card({ card, delay = 0 }: { card: Card; delay?: number }) {
</h2>
{/* authors */}

{card.team?.length > 0 ? (
<div className="flex flex-row flex-wrap gap-x-2">
{(card?.team ?? []).map((author) => (
<span
className="text-sm font-bold italic text-blue-500 md:text-lg"
key={typeof author === 'object' ? author.firstName : author}
>
{typeof author === 'object' ? `${author.firstName} ${author.lastName}` : author}
{
// eslint-disable-next-line no-nested-ternary
card.team?.length > 0 ? (
<div className="flex flex-row flex-wrap gap-x-2">
{(card?.team ?? []).map((author) => (
<span
className="text-sm font-bold italic text-blue-500 md:text-lg"
key={typeof author === 'object' ? author.firstName : author}
>
{typeof author === 'object'
? `${author.firstName} ${author.lastName}`
: author}
</span>
))}
</div>
) : card.team.length > 3 ? (
<div className="flex flex-row gap-2">
<span className="text-sm font-bold italic text-blue-500 md:text-lg">
{typeof card.team[0] === 'object'
? `${card.team[0].firstName} ${card.team[0].lastName} et al.`
: card.team[0]}
</span>
))}
</div>
) : card.team.length > 3 ? (
<div className="flex flex-row gap-2">
<span className="text-sm font-bold italic text-blue-500 md:text-lg">
{typeof card.team[0] === 'object'
? `${card.team[0].firstName} ${card.team[0].lastName} et al.`
: card.team[0]}
</span>
</div>
) : null}
</div>
) : null
}
</div>

<div className="flex items-center gap-2">
Expand Down
18 changes: 9 additions & 9 deletions apps/trialanderror.org/src/app/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { EasyMenu } from '@/types'
import Image from 'next/image'
import Link from 'next/link'
import {
Expand All @@ -9,6 +8,7 @@ import {
FaMastodon,
FaTwitter,
} from 'react-icons/fa'
import { EasyMenu } from '@/types'
import { getNavigation } from '../../server/nav'
import { SignUp } from './SignUp'

Expand Down Expand Up @@ -120,28 +120,28 @@ export async function Footer() {
<div className="grid grid-cols-2 gap-8 xl:col-span-2">
{navigation.items
?.slice(0, Math.floor((navigation.items ?? []).length / 2 + 0.9))
?.map(({ title }, idx) => (
?.map(({ title: t }, idx) => (
// {Object.entries(navigation).map(([name, links]) => (
<div className="md:grid md:grid-cols-2 md:gap-8" key={title}>
<div className="md:grid md:grid-cols-2 md:gap-8" key={t}>
{(navigation.items ?? [])
?.slice(idx * 2, idx * 2 + 2)
.map(({ title, children, url, target }) => (
.map(({ title, children }) => (
<div
key={title} //className={idx % 2 === 0 ? 'mt-12 md:mt-0' : ''}>
key={title} // className={idx % 2 === 0 ? 'mt-12 md:mt-0' : ''}>
className="mt-12 md:mt-0"
>
<h3 className="text-sm font-semibold uppercase tracking-wider text-slate-100">
{title}
</h3>
<ul role="list" className="mt-4 space-y-4">
{(children ?? []).map(({ title, url, target }) => (
<li key={title}>
<ul className="mt-4 space-y-4">
{(children ?? []).map(({ title: nestedTitle, url, target }) => (
<li key={nestedTitle}>
<Link
href={url!}
target={target || url?.startsWith('http') ? '_blank' : undefined}
className="text-base text-slate-300 transition-colors hover:text-orange-500"
>
{title}
{nestedTitle}
</Link>
</li>
))}
Expand Down
17 changes: 9 additions & 8 deletions apps/trialanderror.org/src/app/components/Frame.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'use client';
'use client'

import { motion, useInView } from 'framer-motion'
import { useRef } from 'react'

import { motion, useInView } from 'framer-motion';
import { useRef, useState } from 'react';
export function Frame() {
const ref = useRef<SVGSVGElement>(null);
const ref = useRef<SVGSVGElement>(null)

const isInView = useInView(ref, {
// once: true,
});
console.log(isInView);
})
console.log(isInView)

return (
// <div className="absolute h-screen w-screen">
Expand All @@ -19,7 +20,7 @@ export function Frame() {
className="absolute inset-6 -z-20 flex h-full w-[calc(100vw-3rem)] md:inset-20 md:w-[calc(100vw-10rem)]"
preserveAspectRatio="none"
ref={ref}
pointerEvents={'none'}
pointerEvents="none"
// vectorEffect="non-scaling-stroke"
>
<motion.rect
Expand All @@ -45,5 +46,5 @@ export function Frame() {
</svg>
// <div className="absolute left-[3.6vw] right-[3.6vw] bottom-[18vw] top-[18vw] -z-20 border-4 border-blue-500 md:top-[10vw] md:border-[6px] lg:top-[3vw] lg:bottom-[3vw]" />
// </div>
);
)
}
7 changes: 3 additions & 4 deletions apps/trialanderror.org/src/app/components/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client'
import { Frame } from './Frame'

import { motion } from 'framer-motion'
import { Frame } from './Frame'

export function Hero() {
return (
<div className="relative flex min-h-screen w-screen flex-col justify-center">
return <div className="relative flex min-h-screen w-screen flex-col justify-center">
{/* <div className="max-w-screen absolute inset-6 -z-20 min-h-screen border-4 border-blue-500 md:inset-20 md:border-[6px]" /> */}
<Frame />
<div className="relative mt-[20vh] grid w-full grid-cols-6 items-center justify-center md:mt-[40vh]">
Expand Down Expand Up @@ -38,5 +38,4 @@ export function Hero() {
</motion.div>
</div>
</div>
)
}
Loading

1 comment on commit 922e67b

@vercel
Copy link

@vercel vercel bot commented on 922e67b Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.