Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #5

Merged
merged 35 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ccae4c3
kody to pat
goodeats Oct 20, 2023
b20c2f1
link to my project
goodeats Oct 20, 2023
0cf3076
title change
goodeats Oct 21, 2023
bc2d7a5
added remix dev tools
goodeats Oct 21, 2023
d7fde23
dev tools added to readme
goodeats Oct 21, 2023
57eedcd
component template for user dropdown; making dropdown for navigation …
goodeats Oct 21, 2023
ec1bfb4
added husky for precommit; run build and validate
goodeats Oct 22, 2023
1cc4dbf
readme update
goodeats Oct 22, 2023
4630c96
layer components, starting with header and nav
goodeats Oct 22, 2023
6aa6da6
more layer components; templates for header that includes nav and nav…
goodeats Oct 22, 2023
d7d0bdf
husky check if port in use before pre-commit hook runs commands
goodeats Oct 22, 2023
850e65c
page footer
goodeats Oct 22, 2023
c82ecad
page sidebar lists dynamic data; main container and content layouts
goodeats Oct 22, 2023
e711e85
page content index
goodeats Oct 22, 2023
27d48e9
page content show
goodeats Oct 23, 2023
dca3a1b
kody to pat
goodeats Oct 20, 2023
383c146
link to my project
goodeats Oct 24, 2023
601fb7a
added remix dev tools
goodeats Oct 24, 2023
670a506
added husky for precommit; run build and validate
goodeats Oct 24, 2023
95227f6
preparing e2e tests to be more scalable, helper functions, integratio…
goodeats Oct 23, 2023
2599b68
removing prisma integration testing which was causing bugs
goodeats Oct 23, 2023
dc27284
form templates for fields, remix form component
goodeats Oct 24, 2023
00e47b0
easier password ha
goodeats Oct 24, 2023
cd84384
refactored tests; more DRY, human readable
goodeats Oct 24, 2023
cd9c74b
ref warning 🦓
goodeats Oct 24, 2023
f20693f
Merge branch 'main' into dev
goodeats Oct 25, 2023
ea21114
full width on mobile
goodeats Oct 25, 2023
a1cd8d2
button component moved to primitives and accessible from components d…
goodeats Oct 25, 2023
99b2e35
checkbox
goodeats Oct 25, 2023
071c276
making all components accessible from components dir
goodeats Oct 25, 2023
1986301
e2e tests for /users/username page; removed username.test
goodeats Oct 26, 2023
45fd4ea
e2e tests for /admin
goodeats Oct 26, 2023
7aa2e6e
Refactor PageHeader to conditionally render NavSearch based on userId
goodeats Oct 26, 2023
f944a85
refactored sidebar for admin to use
goodeats Oct 26, 2023
d30970a
fix
goodeats Oct 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if lsof -Pi :3000 -sTCP:LISTEN -t >/dev/null ; then
echo "🚨🚨🚨"
echo "Port 3000 is already in use, please close the process and try again."
echo "🚨🚨🚨"
echo "🤡🤡🤡"
exit 1
else
npm run build
Expand Down
148 changes: 0 additions & 148 deletions app/components/forms.tsx

This file was deleted.

11 changes: 11 additions & 0 deletions app/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export * from './ui/index.ts'
export * from './layout/index.ts'
export * from './templates/index.ts'

export * from './confetti.tsx'
export * from './error-boundary.tsx'
export * from './floating-toolbar.tsx'
export * from './progress-bar.tsx'
export * from './search-bar.tsx'
export * from './spacer.tsx'
export * from './toaster.tsx'
3 changes: 1 addition & 2 deletions app/components/layout/content-actionbar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Link } from '@remix-run/react'
import { Button, Icon, type IconName } from '#app/components/index.ts'
import { DeleteNote } from '#app/routes/users+/$username_+/notes.$noteId.tsx'
import { floatingToolbarClassName } from '../floating-toolbar.tsx'
import { Button } from '../ui/button.tsx'
import { Icon, type IconName } from '../ui/icon.tsx'

interface ContentActionbarProps {
timestamp?: string
Expand Down
1 change: 0 additions & 1 deletion app/components/layout/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const Content = React.forwardRef<HTMLElement, ContentProps>(
if (ref && typeof ref !== 'function') {
throw new Error('Ref must be a function')
}

const Comp = asChild ? Slot : 'div'
return (
<Comp
Expand Down
1 change: 1 addition & 0 deletions app/components/layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
export * from './content-header.tsx'
export * from './content-images.tsx'
export * from './footer.tsx'
export * from './header.tsx'

Check failure on line 7 in app/components/layout/index.ts

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Cannot find module './header.tsx' or its corresponding type declarations.

Check failure on line 7 in app/components/layout/index.ts

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Cannot find module './header.tsx' or its corresponding type declarations.
export * from './list.tsx'
export * from './list-item.tsx'
export * from './main.tsx'
export * from './main-container.tsx'
export * from './main-content.tsx'
export * from './nav.tsx'

Check failure on line 13 in app/components/layout/index.ts

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Cannot find module './nav.tsx' or its corresponding type declarations.

Check failure on line 13 in app/components/layout/index.ts

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Cannot find module './nav.tsx' or its corresponding type declarations.
export * from './nav-logo.tsx'
export * from './nav-search.tsx'
export * from './nav-user-controls.tsx'
export * from './sidebar.tsx'
export * from './sidebar-header.tsx'
export * from './sidebar-avatar.tsx'
export * from './sidebar-list.tsx'
2 changes: 1 addition & 1 deletion app/components/layout/nav-user-controls.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Link } from '@remix-run/react'
import { Button } from '#app/components/index.ts'
import { getUserImgSrc } from '#app/utils/misc.tsx'
import { useOptionalUser, useUser } from '#app/utils/user.ts'
import DropdownNavigation from '../templates/dropdown-navigation.tsx'
import { Button } from '../ui/button.tsx'

function NavUserControls() {
const user = useOptionalUser()
Expand Down
28 changes: 6 additions & 22 deletions app/components/layout/sidebar-avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
import { Link } from '@remix-run/react'
import { getUserImgSrc } from '#app/utils/misc.tsx'

interface SidebarAvatarProps {
ownerDisplayName: string
ownerUsername: string
ownerImageId?: string | null
title?: string
}

function SidebarAvatar({
ownerDisplayName,
ownerUsername,
ownerImageId,
title,
}: SidebarAvatarProps) {
function SidebarAvatar({ ownerDisplayName, ownerImageId }: SidebarAvatarProps) {
return (
<Link
to={`/users/${ownerUsername}`}
className="flex flex-col items-center justify-center gap-2 bg-muted pb-4 pl-8 pr-4 pt-12 lg:flex-row lg:justify-start lg:gap-4"
>
<img
src={getUserImgSrc(ownerImageId)}
alt={ownerDisplayName}
className="h-16 w-16 rounded-full object-cover lg:h-24 lg:w-24"
/>
<h1 className="text-center text-base font-bold md:text-lg lg:text-left lg:text-2xl">
{title || ownerDisplayName}
</h1>
</Link>
<img
src={getUserImgSrc(ownerImageId)}
alt={ownerDisplayName}
className="h-16 w-16 rounded-full object-cover lg:h-24 lg:w-24"
/>
)
}

Expand Down
19 changes: 19 additions & 0 deletions app/components/layout/sidebar-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Link } from '@remix-run/react'

interface SidebarHeaderProps {
to: string
children?: React.ReactNode
}

function SidebarHeader({ to, children }: SidebarHeaderProps) {
return (
<Link
to={to}
className="flex flex-col items-center justify-center gap-2 bg-muted pb-4 pl-8 pr-4 pt-12 lg:flex-row lg:justify-start lg:gap-4"
>
{children}
</Link>
)
}

export { SidebarHeader }
13 changes: 7 additions & 6 deletions app/components/layout/sidebar-list.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { NavLink } from '@remix-run/react'
import { Icon } from '#app/components/index.ts'
import { cn } from '#app/utils/misc.tsx'
import { type OwnerListData } from '#app/utils/user.ts'
import { Icon } from '../ui/icon.tsx'
import { ListItem } from './list-item.tsx'
import { List } from './list.tsx'

interface SidebarAvatarProps {
isOwner: boolean
displayNew: boolean
items: OwnerListData[]
newTitle?: string
}

const navLinkDefaultClassName =
'line-clamp-2 block rounded-l-full py-2 pl-8 pr-6 text-base lg:text-xl'

function SidebarList({ isOwner, items }: SidebarAvatarProps) {
const newItem = () => {
function SidebarList({ displayNew, items, newTitle }: SidebarAvatarProps) {
const NewItem = () => {
return (
<ListItem variant="sidebar">
<NavLink
Expand All @@ -23,15 +24,15 @@ function SidebarList({ isOwner, items }: SidebarAvatarProps) {
cn(navLinkDefaultClassName, isActive && 'bg-accent')
}
>
<Icon name="plus">New Note</Icon>
<Icon name="plus">{newTitle || 'Create New'}</Icon>
</NavLink>
</ListItem>
)
}

return (
<List variant="sidebar">
{isOwner ? newItem() : null}
{displayNew ? <NewItem /> : null}
{items.map(item => (
<ListItem key={item.id} variant="sidebar">
<NavLink
Expand Down
2 changes: 1 addition & 1 deletion app/components/progress-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useNavigation } from '@remix-run/react'
import { useEffect, useRef, useState } from 'react'
import { useSpinDelay } from 'spin-delay'
import { Icon } from '#app/components/index.ts'
import { cn } from '#app/utils/misc.tsx'
import { Icon } from './ui/icon.tsx'

function EpicProgress() {
const transition = useNavigation()
Expand Down
5 changes: 1 addition & 4 deletions app/components/search-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Form, useSearchParams, useSubmit } from '@remix-run/react'
import { useId } from 'react'
import { Input, Icon, Label, StatusButton } from '#app/components/index.ts'
import { useDebounce, useIsPending } from '#app/utils/misc.tsx'
import { Icon } from './ui/icon.tsx'
import { Input } from './ui/input.tsx'
import { Label } from './ui/label.tsx'
import { StatusButton } from './ui/status-button.tsx'

export function SearchBar({
status,
Expand Down
7 changes: 4 additions & 3 deletions app/components/templates/dropdown-navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Link, useSubmit, Form } from '@remix-run/react'
import React, { useRef } from 'react'
import { Button } from '#app/components/ui/button.tsx'
import {
Button,
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuPortal,
} from '#app/components/ui/dropdown-menu.tsx'
import { Icon, type IconName } from '../ui/icon.tsx'
Icon,
type IconName,
} from '#app/components/index.ts'

interface DropdownNavigationMenuItem {
label: string
Expand Down
10 changes: 7 additions & 3 deletions app/components/templates/layout/page-header.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import {
Header,

Check failure on line 2 in app/components/templates/layout/page-header.tsx

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Module '"#app/components/layout/index.ts"' has no exported member 'Header'.

Check failure on line 2 in app/components/templates/layout/page-header.tsx

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Module '"#app/components/layout/index.ts"' has no exported member 'Header'.
Nav,

Check failure on line 3 in app/components/templates/layout/page-header.tsx

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Module '"#app/components/layout/index.ts"' has no exported member 'Nav'.

Check failure on line 3 in app/components/templates/layout/page-header.tsx

View workflow job for this annotation

GitHub Actions / ʦ TypeScript

Module '"#app/components/layout/index.ts"' has no exported member 'Nav'.
NavLogo,
NavSearch,
NavUserControls,
} from '#app/components/layout/index.ts'

function PageHeader() {
interface PageHeaderProps {
userId?: string | undefined
}

function PageHeader({ userId }: PageHeaderProps) {
return (
<Header className="container py-6">
<Nav variant="marketing">
<div className="flex flex-wrap items-center justify-between gap-4 sm:flex-nowrap md:gap-8">
<NavLogo />
<NavSearch variant="desktop" />
{userId && <NavSearch variant="desktop" />}
<NavUserControls />
<NavSearch variant="mobile" />
{userId && <NavSearch variant="mobile" />}
</div>
</Nav>
</Header>
Expand Down
Loading
Loading