Responsiveness

pull/4269/head
Kamran Ahmed 1 year ago
parent 5b541dfb3d
commit 35148cb8a3
  1. 22
      src/components/AccountSidebar.astro
  2. 10
      src/components/CreateTeam/CreateTeamForm.tsx
  3. 2
      src/components/CreateTeam/RoadmapSelector.tsx
  4. 6
      src/components/CreateTeam/Step0.tsx
  5. 2
      src/components/CreateTeam/Step1.tsx
  6. 38
      src/components/CreateTeam/Step2.tsx
  7. 8
      src/components/CreateTeam/Step3.tsx
  8. 8
      src/components/Navigation/AccountDropdown.astro
  9. 174
      src/components/TeamDropdown/TeamDropdown.tsx
  10. 2
      src/components/TeamSidebar.tsx

@ -66,17 +66,17 @@ const sidebarLinks = [
id='settings-menu-dropdown' id='settings-menu-dropdown'
class='absolute left-0 right-0 z-10 mt-1 hidden space-y-1.5 bg-white p-2 shadow-lg' class='absolute left-0 right-0 z-10 mt-1 hidden space-y-1.5 bg-white p-2 shadow-lg'
> >
<!--<li>--> <li>
<!-- <a--> <a
<!-- href='/team'--> href='/team'
<!-- class={`flex w-full items-center rounded px-3 py-1.5 text-sm text-slate-900 hover:bg-slate-200 ${--> class={`flex w-full items-center rounded px-3 py-1.5 text-sm text-slate-900 hover:bg-slate-200 ${
<!-- activePageId === 'team' ? 'bg-slate-100' : ''--> activePageId === 'team' ? 'bg-slate-100' : ''
<!-- }`}--> }`}
<!-- >--> >
<!-- <AstroIcon icon={'users'} class={`h-4 w-4 mr-2`} />--> <AstroIcon icon={'users'} class={`h-4 w-4 mr-2`} />
<!-- Teams--> Teams
<!-- </a>--> </a>
<!--</li>--> </li>
{ {
sidebarLinks.map((sidebarLink) => { sidebarLinks.map((sidebarLink) => {
const isActive = activePageId === sidebarLink.id; const isActive = activePageId === sidebarLink.id;

@ -190,14 +190,14 @@ export function CreateTeamForm() {
} }
return ( return (
<div className={'mx-auto max-w-[700px] py-6'}> <div className={'mx-auto max-w-[700px] py-1 md:py-6'}>
<div className={'mb-8 flex flex-col items-center'}> <div className={'mb-3 md:mb-8 pb-3 md:pb-0 border-b md:border-b-0 flex flex-col items-start md:items-center'}>
<h1 className={'text-4xl font-bold'}>Create Team</h1> <h1 className={'text-xl md:text-4xl font-bold'}>Create Team</h1>
<p className={'mt-2 text-gray-500'}> <p className={'mt-1 md:mt-2 text-sm md:text-base text-gray-500'}>
Complete the steps below to create your team Complete the steps below to create your team
</p> </p>
</div> </div>
<div className="mb-8 mt-8 flex w-full"> <div className="mb-8 mt-8 hidden sm:flex w-full">
<Stepper <Stepper
activeIndex={stepIndex} activeIndex={stepIndex}
completeSteps={completedSteps} completeSteps={completedSteps}

@ -163,7 +163,7 @@ export function RoadmapSelector(props: RoadmapSelectorProps) {
)} )}
{teamResourceConfig.length > 0 && ( {teamResourceConfig.length > 0 && (
<div className="mt-4 grid grid-cols-3 flex-wrap gap-2.5"> <div className="mt-4 grid grid-cols-1 sm:grid-cols-3 flex-wrap gap-2.5">
{teamResourceConfig.map(({ resourceId, removed: removedTopics }) => { {teamResourceConfig.map(({ resourceId, removed: removedTopics }) => {
const roadmapTitle = const roadmapTitle =
allRoadmaps.find((roadmap) => roadmap.id === resourceId)?.title || allRoadmaps.find((roadmap) => roadmap.id === resourceId)?.title ||

@ -70,7 +70,7 @@ export function Step0(props: Step0Props) {
return ( return (
<> <>
<div className={'flex flex-row gap-3'}> <div className={'flex flex-col sm:flex-row gap-3'}>
{validTeamTypes.map((validTeamType) => ( {validTeamTypes.map((validTeamType) => (
<button <button
className={`flex flex-grow flex-col items-center rounded-lg border px-5 py-12 ${ className={`flex flex-grow flex-col items-center rounded-lg border px-5 py-12 ${
@ -100,11 +100,11 @@ export function Step0(props: Step0Props) {
{/*Error message*/} {/*Error message*/}
{error && <div className="mt-4 text-sm text-red-500">{error}</div>} {error && <div className="mt-4 text-sm text-red-500">{error}</div>}
<div className="mt-4 flex flex-row items-center justify-between gap-2"> <div className="mt-4 flex flex-col md:flex-row items-stretch md:items-center justify-between gap-2">
<a <a
href="/account" href="/account"
className={ className={
'rounded-md border border-red-400 bg-white px-8 py-2 text-red-500' 'rounded-md border border-red-400 bg-white px-8 py-2 text-red-500 text-center'
} }
> >
Cancel Cancel

@ -237,7 +237,7 @@ export function Step1(props: Step1Props) {
</div> </div>
)} )}
<div className="mt-4 flex flex-row items-center justify-between gap-2"> <div className="mt-4 flex flex-col md:flex-row items-center justify-between gap-2">
<button <button
type="button" type="button"
onClick={onBack} onClick={onBack}

@ -17,7 +17,7 @@ export function Step2(props: Step2Props) {
<> <>
<div className="mt-4 flex w-full flex-col"> <div className="mt-4 flex w-full flex-col">
<div className="mb-1 mt-2"> <div className="mb-1 mt-2">
<h2 className="mb-1.5 text-2xl font-bold">Select Roadmaps</h2> <h2 className="mb-1 md:mb-1.5 text-lg md:text-2xl font-bold">Select Roadmaps</h2>
<p className="text-sm text-gray-700"> <p className="text-sm text-gray-700">
You can always add and customize your roadmaps later. You can always add and customize your roadmaps later.
</p> </p>
@ -30,7 +30,7 @@ export function Step2(props: Step2Props) {
/> />
</div> </div>
<div className="mt-4 flex flex-row items-center justify-between gap-2"> <div className="mt-4 flex flex-col md:flex-row items-stretch md:items-center justify-between gap-2">
<button <button
type="button" type="button"
onClick={onBack} onClick={onBack}
@ -41,17 +41,29 @@ export function Step2(props: Step2Props) {
<span className="mr-1">&larr;</span> <span className="mr-1">&larr;</span>
Previous Step Previous Step
</button> </button>
<button
type="submit" <div className={'flex gap-2'}>
disabled={teamResourceConfig.length === 0} <button
onClick={onNext} type="button"
className={ onClick={onNext}
'rounded-md border bg-black px-4 py-2 text-white disabled:opacity-50' className={
} 'flex-grow rounded-md border border-gray-300 bg-white px-4 py-2 text-gray-500 hover:border-gray-400 hover:text-black md:flex-auto'
> }
Next Step >
<span className="ml-1">&rarr;</span> Skip for Now
</button> </button>
<button
type="submit"
disabled={teamResourceConfig.length === 0}
onClick={onNext}
className={
'rounded-md border bg-black px-4 py-2 text-white disabled:opacity-50'
}
>
Next Step
<span className="ml-1">&rarr;</span>
</button>
</div>
</div> </div>
</> </>
); );

@ -76,7 +76,7 @@ export function Step3(props: Step3Props) {
return ( return (
<form className="mt-4 flex w-full flex-col" onSubmit={onSubmit}> <form className="mt-4 flex w-full flex-col" onSubmit={onSubmit}>
<div class="mb-1 mt-2"> <div class="mb-1 mt-2">
<h2 class="mb-2 text-2xl font-bold">Invite your Team</h2> <h2 class="mb-1 md:mb-2 text-lg md:text-2xl font-bold">Invite your Team</h2>
<p class="text-sm text-gray-700"> <p class="text-sm text-gray-700">
Use the form below to invite your team members to your team. You can Use the form below to invite your team members to your team. You can
also invite them later. also invite them later.
@ -85,7 +85,7 @@ export function Step3(props: Step3Props) {
<div className="mt-4 flex flex-col gap-1"> <div className="mt-4 flex flex-col gap-1">
{users.map((user, userCounter) => { {users.map((user, userCounter) => {
return ( return (
<div className="flex flex-row gap-2" key={user.id}> <div className="flex flex-col sm:flex-row gap-2" key={user.id}>
<input <input
ref={userCounter === users.length - 1 ? emailInputRef : null} ref={userCounter === users.length - 1 ? emailInputRef : null}
autofocus={true} autofocus={true}
@ -163,7 +163,7 @@ export function Step3(props: Step3Props) {
</div> </div>
)} )}
<div className="mt-4 flex flex-row items-center justify-between gap-2"> <div className="mt-4 flex flex-col sm:flex-row items-stretch md:items-center justify-between gap-2">
<button <button
type="button" type="button"
onClick={onBack} onClick={onBack}
@ -179,7 +179,7 @@ export function Step3(props: Step3Props) {
type="button" type="button"
onClick={onNext} onClick={onNext}
className={ className={
'rounded-md border border-gray-300 bg-white px-4 py-2 text-gray-500 hover:border-gray-400 hover:text-black' 'rounded-md flex-grow md:flex-auto border border-gray-300 bg-white px-4 py-2 text-gray-500 hover:border-gray-400 hover:text-black'
} }
> >
Skip for Now Skip for Now

@ -30,6 +30,14 @@ import Icon from '../AstroIcon.astro';
Profile Profile
</a> </a>
</li> </li>
<li class='px-1'>
<a
href='/team'
class='block rounded px-4 py-2 text-sm font-medium text-slate-100 hover:bg-slate-700'
>
Teams
</a>
</li>
<li class='px-1'> <li class='px-1'>
<button <button
class='block w-full rounded px-4 py-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700' class='block w-full rounded px-4 py-2 text-left text-sm font-medium text-slate-100 hover:bg-slate-700'

@ -9,7 +9,7 @@ import { $currentTeam, $teamList } from '../../stores/team';
import { useStore } from '@nanostores/preact'; import { useStore } from '@nanostores/preact';
import { useTeamId } from '../../hooks/use-team-id'; import { useTeamId } from '../../hooks/use-team-id';
import { useToast } from '../../hooks/use-toast'; import { useToast } from '../../hooks/use-toast';
import type {ValidTeamType} from "../CreateTeam/Step0"; import type { ValidTeamType } from '../CreateTeam/Step0';
const allowedStatus = ['invited', 'joined', 'rejected'] as const; const allowedStatus = ['invited', 'joined', 'rejected'] as const;
export type AllowedMemberStatus = (typeof allowedStatus)[number]; export type AllowedMemberStatus = (typeof allowedStatus)[number];
@ -81,94 +81,102 @@ export function TeamDropdown() {
if ( if (
!user?.email.endsWith('@insightpartners.com') && !user?.email.endsWith('@insightpartners.com') &&
!user?.email.endsWith('@roadmap.sh') && !user?.email.endsWith('@roadmap.sh') &&
!['arikchangma@gmail.com', 'kamranahmed.se@gmail.com', 'stephen.chetcuti@gmail.com'].includes(user?.email!) ![
'arikchangma@gmail.com',
'kamranahmed.se@gmail.com',
'stephen.chetcuti@gmail.com',
].includes(user?.email!)
) { ) {
return null; return null;
} }
return ( return (
<div className="relative mr-2"> <>
<button <div className="relative mr-2">
className="flex w-full cursor-pointer items-center justify-between rounded border p-2 text-sm hover:bg-gray-100" <button
onClick={() => setShowDropdown(!showDropdown)} className="flex w-full cursor-pointer items-center justify-between rounded border p-2 text-sm hover:bg-gray-100"
> onClick={() => setShowDropdown(!showDropdown)}
{pendingTeamIds.length > 0 && (
<span className="absolute -left-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-xs font-medium text-white">
{pendingTeamIds.length}
</span>
)}
<div className="inline-grid grid-cols-[16px_auto] items-center gap-1.5 mr-1.5">
{isLoading && <Spinner className="h-4 w-4" isDualRing={false} />}
{!isLoading && (
<img
src={
selectedAvatar
? `${import.meta.env.PUBLIC_AVATAR_BASE_URL
}/${selectedAvatar}`
: '/images/default-avatar.png'
}
alt=""
className="h-4 w-4 rounded-full object-cover"
/>
)}
<span className="truncate">
{!isLoading && selectedLabel}
{isLoading && 'Loading ..'}
</span>
</div>
<img alt={'show dropdown'} src={ChevronDown} className="h-4 w-4" />
</button>
{showDropdown && (
<div
ref={dropdownRef}
className="absolute top-full z-50 mt-2 w-full rounded-md bg-slate-800 px-2 py-2 text-white shadow-md"
> >
<ul> {pendingTeamIds.length > 0 && (
<li> <span className="absolute -left-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-xs font-medium text-white">
<a {pendingTeamIds.length}
className="flex w-full cursor-pointer items-center gap-2 truncate rounded p-2 text-sm font-medium text-slate-100 hover:bg-slate-700" </span>
href="/account" )}
> <div className="mr-1.5 inline-grid grid-cols-[16px_auto] items-center gap-1.5">
<span className="truncate">Personal Account</span> {isLoading && <Spinner className="h-4 w-4" isDualRing={false} />}
</a> {!isLoading && (
</li> <img
{teamList.map((team) => { src={
let pageLink = ''; selectedAvatar
if (team.status === 'invited') { ? `${
pageLink = `/respond-invite?i=${team.memberId}`; import.meta.env.PUBLIC_AVATAR_BASE_URL
} else if (team.status === 'joined') { }/${selectedAvatar}`
pageLink = `/team/progress?t=${team._id}`; : '/images/default-avatar.png'
} }
alt=""
return ( className="h-4 w-4 rounded-full object-cover"
<li> />
<a )}
className="flex w-full cursor-pointer items-center gap-2 rounded p-2 text-sm font-medium text-slate-100 hover:bg-slate-700" <span className="truncate">
href={`${pageLink}`} {!isLoading && selectedLabel}
> {isLoading && 'Loading ..'}
<span className="flex-grow min-w-0 truncate">{team.name}</span> </span>
{pendingTeamIds.includes(team._id) && ( </div>
<span className="flex rounded-md bg-red-500 px-2 text-xs text-white"> <img alt={'show dropdown'} src={ChevronDown} className="h-4 w-4" />
Invite </button>
</span>
)} {showDropdown && (
</a> <div
</li> ref={dropdownRef}
); className="absolute top-full z-50 mt-2 w-full rounded-md bg-slate-800 px-2 py-2 text-white shadow-md"
})}
</ul>
<a
className="mt-2 flex w-full cursor-pointer items-center justify-center gap-2 rounded bg-gray-100 p-2 text-sm font-medium text-slate-800 hover:opacity-90"
href="/team/new"
> >
<span>+</span> <ul>
<span>New Team</span> <li>
</a> <a
</div> className="flex w-full cursor-pointer items-center gap-2 truncate rounded p-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
)} href="/account"
>
<hr class='my-4' /> <span className="truncate">Personal Account</span>
</div> </a>
</li>
{teamList.map((team) => {
let pageLink = '';
if (team.status === 'invited') {
pageLink = `/respond-invite?i=${team.memberId}`;
} else if (team.status === 'joined') {
pageLink = `/team/progress?t=${team._id}`;
}
return (
<li>
<a
className="flex w-full cursor-pointer items-center gap-2 rounded p-2 text-sm font-medium text-slate-100 hover:bg-slate-700"
href={`${pageLink}`}
>
<span className="min-w-0 flex-grow truncate">
{team.name}
</span>
{pendingTeamIds.includes(team._id) && (
<span className="flex rounded-md bg-red-500 px-2 text-xs text-white">
Invite
</span>
)}
</a>
</li>
);
})}
</ul>
<a
className="mt-2 flex w-full cursor-pointer items-center justify-center gap-2 rounded bg-gray-100 p-2 text-sm font-medium text-slate-800 hover:opacity-90"
href="/team/new"
>
<span>+</span>
<span>New Team</span>
</a>
</div>
)}
</div>
<hr class="my-4" />
</>
); );
} }

@ -76,7 +76,7 @@ export const TeamSidebar: FunctionalComponent<{
}`} }`}
> >
<img alt={'teams'} src={GroupIcon} class={`mr-2 h-4 w-4`} /> <img alt={'teams'} src={GroupIcon} class={`mr-2 h-4 w-4`} />
Teams Personal Account / Teams
</a> </a>
</li> </li>
{sidebarLinks.map((sidebarLink) => { {sidebarLinks.map((sidebarLink) => {

Loading…
Cancel
Save