-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the my team settings page (#680)
- Loading branch information
Showing
14 changed files
with
347 additions
and
11 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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from "react"; | ||
|
||
const JoinTeam: React.FC = () => { | ||
return <div>you have no team! this page is tbd</div>; | ||
}; | ||
|
||
export default JoinTeam; |
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 @@ | ||
import React from "react"; | ||
|
||
interface SectionCardProps { | ||
children?: React.ReactNode; | ||
title?: string; | ||
className?: string; | ||
} | ||
|
||
const SectionCard: React.FC<SectionCardProps> = ({ | ||
children, | ||
title, | ||
className = "", | ||
}) => { | ||
return ( | ||
<div className={className}> | ||
{title !== undefined && ( | ||
<div className="mb-2 text-xl font-semibold tracking-wide">{title}</div> | ||
)} | ||
<div className={`relative rounded bg-white p-6 shadow-md`}> | ||
<div className="absolute inset-0 h-full w-1 rounded-l bg-cyan-600" /> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SectionCard; |
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,46 @@ | ||
import React from "react"; | ||
import Icon from "./Icon"; | ||
import { Switch } from "@headlessui/react"; | ||
|
||
interface DescriptiveCheckboxProps { | ||
checked: boolean; | ||
onChange: (checked: boolean) => void; | ||
title: string; | ||
description: string; | ||
} | ||
|
||
const DescriptiveCheckbox: React.FC<DescriptiveCheckboxProps> = ({ | ||
checked, | ||
onChange, | ||
title, | ||
description, | ||
}) => { | ||
return ( | ||
<Switch | ||
checked={checked} | ||
onChange={onChange} | ||
className={`flex w-full | ||
flex-row items-center justify-between gap-3 rounded-lg px-6 py-4 shadow ring-2 ring-inset | ||
ring-cyan-600/20 transition-all ui-checked:bg-cyan-900/80 ui-checked:ring-0`} | ||
> | ||
<div className="flex flex-col gap-2 text-left"> | ||
<div className="font-semibold ui-checked:text-white ">{title}</div> | ||
<div className="text-sm text-cyan-700 ui-checked:text-cyan-100"> | ||
{description} | ||
</div> | ||
</div> | ||
<div | ||
className="rounded-full p-1.5 ring-2 ring-inset ring-cyan-600/20 transition-all | ||
ui-checked:bg-cyan-500/50 ui-checked:ring-0" | ||
> | ||
<Icon | ||
name="check" | ||
size="sm" | ||
className={`text-cyan-100 opacity-0 ui-checked:opacity-100`} | ||
/> | ||
</div> | ||
</Switch> | ||
); | ||
}; | ||
|
||
export default DescriptiveCheckbox; |
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
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React, { forwardRef } from "react"; | ||
import FormError from "./FormError"; | ||
import FormLabel from "./FormLabel"; | ||
|
||
interface TextAreaProps extends React.ComponentPropsWithoutRef<"textarea"> { | ||
label?: string; | ||
required?: boolean; | ||
className?: string; | ||
errorMessage?: string; | ||
} | ||
|
||
const Input = forwardRef<HTMLTextAreaElement, TextAreaProps>(function Input( | ||
{ label, required = false, className = "", errorMessage, ...rest }, | ||
ref, | ||
) { | ||
const invalid = errorMessage !== undefined; | ||
return ( | ||
<div className={`relative ${invalid ? "mb-1" : ""} ${className}`}> | ||
<label> | ||
<FormLabel label={label} required={required} /> | ||
<div className="relative rounded-md shadow-sm"> | ||
<textarea | ||
ref={ref} | ||
aria-invalid={errorMessage !== undefined ? "true" : "false"} | ||
className={`block w-full rounded-md border-0 px-2 py-1.5 text-gray-900 ring-1 ring-inset | ||
ring-gray-300 placeholder:text-gray-400 focus:outline-none focus:ring-1 focus:ring-inset | ||
focus:ring-cyan-600 sm:text-sm sm:leading-6 | ||
${invalid ? "ring-red-500" : ""}`} | ||
{...rest} | ||
/> | ||
</div> | ||
{invalid && <FormError message={errorMessage} />} | ||
</label> | ||
</div> | ||
); | ||
}); | ||
|
||
export default Input; |
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,57 @@ | ||
import React from "react"; | ||
import { type UserPublic } from "../../utils/types"; | ||
import { useCurrentUser } from "../../contexts/CurrentUserContext"; | ||
|
||
interface MemberListProps { | ||
members: UserPublic[]; | ||
className?: string; | ||
} | ||
|
||
interface UserRowProps { | ||
user: UserPublic; | ||
isCurrentUser?: boolean; | ||
} | ||
const UserRow: React.FC<UserRowProps> = ({ user, isCurrentUser = false }) => { | ||
return ( | ||
<div className="flex flex-row items-center rounded"> | ||
<img | ||
className="h-8 w-8 rounded-full bg-blue-100" | ||
src={user.profile?.avatar_url} | ||
/> | ||
<div className="ml-6 font-semibold"> | ||
{user.username} | ||
{isCurrentUser && ( | ||
<span className="ml-1 font-normal text-gray-600">(you)</span> | ||
)} | ||
{user.is_staff && ( | ||
<span className="ml-1 font-normal text-gray-600">(staff)</span> | ||
)} | ||
</div> | ||
<div className="ml-12 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap text-end text-gray-600"> | ||
{user.profile?.school} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
// Displays a list of the users in members. If the current user is in members, | ||
// displays the current user first. | ||
const MemberList: React.FC<MemberListProps> = ({ members, className = "" }) => { | ||
const { user: currentUser } = useCurrentUser(); | ||
return ( | ||
<div className={`flex flex-col gap-6 ${className}`}> | ||
{/* display current user first */} | ||
{currentUser !== undefined && ( | ||
<UserRow isCurrentUser user={currentUser} /> | ||
)} | ||
{members.map( | ||
(member) => | ||
member.id !== currentUser?.id && ( | ||
<UserRow key={member.id} user={member} /> | ||
), | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default MemberList; |
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
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
Oops, something went wrong.