Skip to content

Commit

Permalink
various design tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
xvvvyz committed Aug 28, 2023
1 parent 391807f commit 429edb6
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 58 deletions.
1 change: 0 additions & 1 deletion app/(account)/_components/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const Avatar = ({ className, file, name, size = 'md' }: AvatarProps) => {
loader={generateImageLoader({ aspectRatio: '1:1' })}
sizes={sizes[size].imgSizes}
src={src}
title={name}
/>
) : (
<span aria-hidden>{Array.from(name)[0]}</span>
Expand Down
14 changes: 10 additions & 4 deletions app/(account)/inputs/_components/filterable-input-link-list.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import Avatar from '@/(account)/_components/avatar';
import INPUT_LABELS from '@/(account)/_constants/constant-input-labels';
import usePrevious from '@/(account)/_hooks/use-previous';
import { ListInputsData } from '@/(account)/_server/list-inputs';
import forceArray from '@/(account)/_utilities/force-array';
Expand Down Expand Up @@ -78,18 +79,23 @@ const FilterableInputLinkList = ({ inputs }: FilterableInputLinkListProps) => {
return (
<li className="flex items-stretch hover:bg-alpha-1" key={input.id}>
<Button
className="m-0 flex w-full gap-4 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
className="m-0 w-full gap-6 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
href={`/inputs/${input.id}`}
variant="link"
>
<div>
{input.label}
<div className="smallcaps pb-0.5 pt-1">
{INPUT_LABELS[input.type]}
</div>
</div>
{!!avatars.length && (
<div className="-my-0.5 flex flex-wrap gap-1">
<div className="-my-0.5 ml-auto flex shrink-0 gap-1.5">
{avatars.map(({ id, image_uri, name }) => (
<Avatar file={image_uri} key={id} name={name} size="sm" />
<Avatar file={image_uri} key={id} name={name} size="xs" />
))}
</div>
)}
{input.label}
</Button>
<InputListItemMenu inputId={input.id} />
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ const EventCard = ({
)}
<EventForm
className={twMerge(
'px-4 py-8 sm:px-8',
!!mission && 'bg-alpha-reverse-1',
'bg-alpha-reverse-1 px-4 py-8 sm:px-8',
!showModule && !showDescription && !event && 'sm:rounded-t',
!event && 'sm:rounded-b',
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const Page = async ({ params: { missionId, subjectId } }: PageProps) => {
return (
<li key={session.id}>
<Button
className="m-0 flex w-full gap-4 px-4 py-3 leading-snug [overflow-wrap:anywhere] hover:bg-alpha-1"
className="m-0 w-full gap-6 px-4 py-3 leading-snug [overflow-wrap:anywhere] hover:bg-alpha-1"
href={
isTeamMember
? `/subjects/${subjectId}/missions/${missionId}/sessions/${session.id}/edit`
Expand All @@ -126,7 +126,7 @@ const Page = async ({ params: { missionId, subjectId } }: PageProps) => {
{session.title}
</span>
)}
<div className="smallcaps pb-1 pt-1 text-fg-4">
<div className="smallcaps pb-0.5 pt-1">
{session.draft ? (
'Draft'
) : new Date(session.scheduled_for ?? '') >
Expand Down
64 changes: 33 additions & 31 deletions app/(account)/subjects/[subjectId]/timeline/@eventTypes/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,41 @@ const Page = async ({ params: { subjectId } }: PageProps) => {

return (
<div className="px-4">
<ul
className={twMerge(
'rounded border border-alpha-1 bg-bg-2 py-1',
isTeamMember && 'rounded-b-none border-b-0',
)}
>
{eventTypes.map((eventType) => (
<li
className="flex items-stretch hover:bg-alpha-1"
key={eventType.id}
>
<Button
className={twMerge(
'm-0 flex w-full gap-4 px-4 py-3 leading-snug [overflow-wrap:anywhere]',
isTeamMember && 'pr-0',
)}
href={`/subjects/${subjectId}/event-types/${eventType.id}`}
variant="link"
{!!eventTypes.length && (
<ul
className={twMerge(
'rounded border border-alpha-1 bg-bg-2 py-1',
isTeamMember && 'rounded-b-none border-b-0',
)}
>
{eventTypes.map((eventType) => (
<li
className="flex items-stretch hover:bg-alpha-1"
key={eventType.id}
>
{eventType.name}
{!isTeamMember && (
<ArrowRightIcon className="ml-auto w-5 shrink-0" />
<Button
className={twMerge(
'm-0 flex w-full gap-4 px-4 py-3 leading-snug [overflow-wrap:anywhere]',
isTeamMember && 'pr-0',
)}
href={`/subjects/${subjectId}/event-types/${eventType.id}`}
variant="link"
>
{eventType.name}
{!isTeamMember && (
<ArrowRightIcon className="ml-auto w-5 shrink-0" />
)}
</Button>
{isTeamMember && (
<EventTypeLinkListItemMenu
eventTypeId={eventType.id}
subjectId={subjectId}
/>
)}
</Button>
{isTeamMember && (
<EventTypeLinkListItemMenu
eventTypeId={eventType.id}
subjectId={subjectId}
/>
)}
</li>
))}
</ul>
</li>
))}
</ul>
)}
{isTeamMember && (
<div className="flex items-center gap-4">
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TimelineEventCard = ({
const sessionNumber = lastEventType.session?.order + 1;

return (
<article className="rounded border border-alpha-1 bg-bg-2 py-1">
<article className="rounded border border-alpha-1 bg-bg-2 pt-1">
<Button
className="m-0 mb-1 w-full gap-6 p-0 px-4 py-3 leading-snug hover:bg-alpha-1"
href={
Expand Down Expand Up @@ -99,7 +99,7 @@ const TimelineEventCard = ({
</div>
)}
{!!inputs.length && (
<div className="py-2">
<div className="-my-1.5 pb-4 pt-3">
<table className="w-full table-fixed">
<tbody>
{Object.entries(
Expand Down Expand Up @@ -130,10 +130,8 @@ const TimelineEventCard = ({
),
).map(([id, { label, type, values }]: any) => (
<tr key={id}>
<td className="truncate px-4 py-1 align-top text-fg-4">
{label}
</td>
<td className="truncate p-0 py-1 pr-4 align-top">
<td className="truncate px-4 text-fg-4">{label}</td>
<td className="truncate pr-4">
{formatInputValue[type as InputTypes](values)}
</td>
</tr>
Expand All @@ -143,7 +141,7 @@ const TimelineEventCard = ({
</div>
)}
{!!comments.length && (
<div className="space-y-4 p-4">
<div className="space-y-4 px-4 pb-4 pt-3">
<EventComments
comments={comments}
isTeamMember={isTeamMember}
Expand Down
18 changes: 10 additions & 8 deletions app/(account)/subjects/[subjectId]/timeline/@missions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ const Page = async ({ params: { subjectId } }: PageProps) => {

return (
<div className="px-4">
<ul
className={twMerge(
'm-0 rounded border border-alpha-1 bg-bg-2 py-1',
isTeamMember && 'rounded-b-none border-b-0',
)}
>
{listItems}
</ul>
{!!listItems.length && (
<ul
className={twMerge(
'm-0 rounded border border-alpha-1 bg-bg-2 py-1',
isTeamMember && 'rounded-b-none border-b-0',
)}
>
{listItems}
</ul>
)}
{isTeamMember && (
<div className="flex items-center gap-4">
<Button
Expand Down
4 changes: 2 additions & 2 deletions app/(account)/subjects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const Page = async () => {
key={subject.id}
>
<Button
className="m-0 flex w-full gap-4 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
className="m-0 w-full gap-4 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
href={`/subjects/${subject.id}/timeline`}
variant="link"
>
Expand All @@ -83,7 +83,7 @@ const Page = async () => {
{clientSubjects.map((subject) => (
<li key={subject.id}>
<Button
className="m-0 flex w-full gap-4 px-4 py-3 leading-snug [overflow-wrap:anywhere] hover:bg-alpha-1"
className="m-0 w-full gap-6 px-4 py-3 leading-snug [overflow-wrap:anywhere] hover:bg-alpha-1"
href={`/subjects/${subject.id}/timeline`}
variant="link"
>
Expand Down
2 changes: 1 addition & 1 deletion app/(account)/templates/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Page = async () => {
key={template.id}
>
<Button
className="m-0 flex w-full gap-4 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
className="m-0 w-full gap-6 px-4 py-3 pr-0 leading-snug [overflow-wrap:anywhere]"
href={`/templates/${template.id}`}
variant="link"
>
Expand Down

0 comments on commit 429edb6

Please sign in to comment.