change: hide project heading when project name is null

This commit is contained in:
Jordan Knott 2020-05-31 00:15:10 -05:00
parent e87a2ea0b7
commit 67ac88856b
4 changed files with 19 additions and 17 deletions

View File

@ -6,7 +6,7 @@ import UserIDContext from 'App/context';
import { useMeQuery } from 'shared/generated/graphql'; import { useMeQuery } from 'shared/generated/graphql';
type GlobalTopNavbarProps = { type GlobalTopNavbarProps = {
name: string; name: string | null;
projectMembers?: null | Array<TaskUser>; projectMembers?: null | Array<TaskUser>;
onSaveProjectName?: (projectName: string) => void; onSaveProjectName?: (projectName: string) => void;
}; };

View File

@ -411,7 +411,7 @@ const Project = () => {
if (loading) { if (loading) {
return ( return (
<> <>
<GlobalTopNavbar onSaveProjectName={projectName => {}} name="Loading..." /> <GlobalTopNavbar onSaveProjectName={projectName => {}} name="" />
</> </>
); );
} }

View File

@ -41,7 +41,7 @@ const Projects = () => {
const { projects } = data; const { projects } = data;
return ( return (
<> <>
<GlobalTopNavbar onSaveProjectName={() => {}} name="Projects" /> <GlobalTopNavbar onSaveProjectName={() => {}} name={null} />
<ProjectGrid> <ProjectGrid>
{projects.map(project => ( {projects.map(project => (
<ProjectLink key={project.id} to={`/projects/${project.id}`}> <ProjectLink key={project.id} to={`/projects/${project.id}`}>

View File

@ -87,12 +87,18 @@ const ProjectHeading: React.FC<ProjectHeadingProps> = ({ projectName: initialPro
{projectName} {projectName}
</ProjectName> </ProjectName>
)} )}
<ProjectSettingsButton>
<AngleDown color="#c2c6dc" />
</ProjectSettingsButton>
<ProjectSettingsButton>
<Star width={16} height={16} color="#c2c6dc" />
</ProjectSettingsButton>
</> </>
); );
}; };
type NavBarProps = { type NavBarProps = {
projectName: string; projectName: string | null;
onProfileClick: (bottom: number, right: number) => void; onProfileClick: (bottom: number, right: number) => void;
onSaveProjectName?: (projectName: string) => void; onSaveProjectName?: (projectName: string) => void;
onNotificationClick: () => void; onNotificationClick: () => void;
@ -141,20 +147,16 @@ const NavBar: React.FC<NavBarProps> = ({
<ProjectActions> <ProjectActions>
<ProjectMeta> <ProjectMeta>
<ProjectSwitcher>Projects</ProjectSwitcher> <ProjectSwitcher>Projects</ProjectSwitcher>
<ProjectHeading projectName={projectName} onSaveProjectName={onSaveProjectName} /> {projectName && <ProjectHeading projectName={projectName} onSaveProjectName={onSaveProjectName} />}
<ProjectSettingsButton>
<AngleDown color="#c2c6dc" />
</ProjectSettingsButton>
<ProjectSettingsButton>
<Star width={16} height={16} color="#c2c6dc" />
</ProjectSettingsButton>
</ProjectMeta> </ProjectMeta>
{projectName && (
<ProjectTabs> <ProjectTabs>
<ProjectTab active>Board</ProjectTab> <ProjectTab active>Board</ProjectTab>
<ProjectTab>Calender</ProjectTab> <ProjectTab>Calender</ProjectTab>
<ProjectTab>Timeline</ProjectTab> <ProjectTab>Timeline</ProjectTab>
<ProjectTab>Wiki</ProjectTab> <ProjectTab>Wiki</ProjectTab>
</ProjectTabs> </ProjectTabs>
)}
</ProjectActions> </ProjectActions>
<GlobalActions> <GlobalActions>
{projectMembers && ( {projectMembers && (