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

fix: fixed issues in workspace level #2247

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 10 additions & 9 deletions web/components/analytics/scope-and-demand/scope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ export const AnalyticsScope: React.FC<Props> = ({ defaultAnalytics }) => (
<div className="divide-y divide-custom-border-200">
<div>
<h6 className="px-3 text-base font-medium">Pending issues</h6>
{defaultAnalytics.pending_issue_user.length > 0 ? (
{defaultAnalytics.pending_issue_user && defaultAnalytics.pending_issue_user.length > 0 ? (
<BarGraph
data={defaultAnalytics.pending_issue_user}
indexBy="assignees__display_name"
indexBy="assignees__id"
keys={["count"]}
height="250px"
colors={() => `#f97316`}
customYAxisTickValues={defaultAnalytics.pending_issue_user.map((d) => d.count)}
customYAxisTickValues={defaultAnalytics.pending_issue_user.map((d) =>
d.count > 0 ? d.count : 50
)}
tooltip={(datum) => {
const assignee = defaultAnalytics.pending_issue_user.find(
(a) => a.assignees__display_name === `${datum.indexValue}`
(a) => a.assignees__id === `${datum.indexValue}`
);

return (
Expand All @@ -39,18 +41,17 @@ export const AnalyticsScope: React.FC<Props> = ({ defaultAnalytics }) => (
}}
axisBottom={{
renderTick: (datum) => {
const avatar =
defaultAnalytics.pending_issue_user[datum.tickIndex]?.assignees__avatar ?? "";
const assignee = defaultAnalytics.pending_issue_user[datum.tickIndex] ?? "";

if (avatar && avatar !== "")
if (assignee && assignee?.assignees__avatar && assignee?.assignees__avatar !== "")
return (
<g transform={`translate(${datum.x},${datum.y})`}>
<image
x={-8}
y={10}
width={16}
height={16}
xlinkHref={avatar}
xlinkHref={assignee?.assignees__avatar}
style={{ clipPath: "circle(50%)" }}
/>
</g>
Expand All @@ -60,7 +61,7 @@ export const AnalyticsScope: React.FC<Props> = ({ defaultAnalytics }) => (
<g transform={`translate(${datum.x},${datum.y})`}>
<circle cy={18} r={8} fill="#374151" />
<text x={0} y={21} textAnchor="middle" fontSize={9} fill="#ffffff">
{datum.value ? `${datum.value}`.toUpperCase()[0] : "?"}
{datum.value ? `${assignee.assignees__display_name}`.toUpperCase()[0] : "?"}
</text>
</g>
);
Expand Down
2 changes: 1 addition & 1 deletion web/components/project/single-project-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const SingleProjectCard: React.FC<ProjectCardProps> = ({
</button>
) : (
<span className="cursor-default rounded bg-green-600 px-2 py-1 text-xs">
Member
Joined
</span>
)}
{project.is_favorite && (
Expand Down
37 changes: 20 additions & 17 deletions web/pages/[workspaceSlug]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,21 @@ const WorkspacePage: NextPage = () => {
/>
</div>
)}
{projects ? (
projects.length > 0 ? (
<div className="p-8">
<div className="p-8 space-y-8">
<div>
<h3 className="text-2xl font-semibold">
Good {greeting}, {user?.first_name} {user?.last_name}
</h3>
<h6 className="text-custom-text-400 font-medium flex items-center gap-2">
<div>{greeting === "morning" ? "🌤️" : greeting === "afternoon" ? "🌥️" : "🌙️"}</div>
<div>
{DAYS[today.getDay()]}, {renderShortDate(today)} {render12HourFormatTime(today)}
</div>
</h6>
</div>

{projects ? (
projects.length > 0 ? (
<div className="flex flex-col gap-8">
<IssuesStats data={workspaceDashboardData} />
<div className="grid grid-cols-1 gap-8 lg:grid-cols-2">
Expand All @@ -143,17 +155,8 @@ const WorkspacePage: NextPage = () => {
/>
</div>
</div>
</div>
) : (
<div className="p-8">
<h3 className="text-2xl font-semibold">
Good {greeting}, {user?.first_name} {user?.last_name}
</h3>
<h6 className="text-custom-text-400 font-medium">
{greeting === "morning" ? "🌤️" : greeting === "afternoon" ? "🌥️" : "🌙️"}
{DAYS[today.getDay()]}, {renderShortDate(today)} {render12HourFormatTime(today)}
</h6>
<div className="mt-7 bg-custom-primary-100/5 flex justify-between gap-5 md:gap-8">
) : (
<div className="bg-custom-primary-100/5 flex justify-between gap-5 md:gap-8">
<div className="p-5 md:p-8 pr-0">
<h5 className="text-xl font-semibold">Create a project</h5>
<p className="mt-2 mb-5">
Expand All @@ -174,9 +177,9 @@ const WorkspacePage: NextPage = () => {
<Image src={emptyDashboard} alt="Empty Dashboard" />
</div>
</div>
</div>
)
) : null}
)
) : null}
</div>
</WorkspaceAuthorizationLayout>
);
};
Expand Down
Loading