Skip to content

Commit

Permalink
chore: updated meta tags for project issues (#1875)
Browse files Browse the repository at this point in the history
* dev: updated meta tags for project issues

* dev: updated project description in meta tags in plane deploy.
  • Loading branch information
gurusainath committed Aug 16, 2023
1 parent 2c43a15 commit 1ded8f4
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
27 changes: 25 additions & 2 deletions apps/space/app/[workspace_slug]/[project_slug]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
"use client";

// next imports
import Link from "next/link";
import Image from "next/image";
import { Metadata, ResolvingMetadata } from "next";
// components
import IssueNavbar from "components/issues/navbar";
import IssueFilter from "components/issues/filters-render";
// service
import ProjectService from "services/project.service";

type LayoutProps = {
params: { workspace_slug: string; project_slug: string };
};

export async function generateMetadata({ params }: LayoutProps): Promise<Metadata> {
// read route params
const { workspace_slug, project_slug } = params;
const projectServiceInstance = new ProjectService();

const project = await projectServiceInstance?.getProjectSettingsAsync(workspace_slug, project_slug);

return {
title: `${project?.project_details?.name} | ${workspace_slug}`,
description: `${project?.project_details?.description || `${project?.project_details?.name} | ${workspace_slug}`}`,
icons: `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>${
typeof project?.project_details?.emoji != "object"
? String.fromCodePoint(parseInt(project?.project_details?.emoji))
: "✈️"
}</text></svg>`,
};
}

const RootLayout = ({ children }: { children: React.ReactNode }) => (
<div className="relative w-screen min-h-[500px] h-screen overflow-hidden flex flex-col">
Expand Down
2 changes: 1 addition & 1 deletion apps/space/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from "react";

const HomePage = () => (
<div className="relative w-screen h-screen flex justify-center items-center text-5xl">Plane Space</div>
<div className="relative w-screen h-screen flex justify-center items-center text-5xl">Plane Deploy</div>
);

export default HomePage;
20 changes: 19 additions & 1 deletion apps/space/components/issues/navbar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use client";

// next imports
import Image from "next/image";
// components
import { NavbarSearch } from "./search";
import { NavbarIssueBoardView } from "./issue-board-view";
Expand All @@ -12,6 +14,18 @@ import { observer } from "mobx-react-lite";
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";

const renderEmoji = (emoji: string | { name: string; color: string }) => {
if (!emoji) return;

if (typeof emoji === "object")
return (
<span style={{ color: emoji.color }} className="material-symbols-rounded text-lg">
{emoji.name}
</span>
);
else return isNaN(parseInt(emoji)) ? emoji : String.fromCodePoint(parseInt(emoji));
};

const IssueNavbar = observer(() => {
const store: RootStore = useMobxStore();

Expand All @@ -20,7 +34,11 @@ const IssueNavbar = observer(() => {
{/* project detail */}
<div className="flex-shrink-0 flex items-center gap-2">
<div className="w-[32px] h-[32px] rounded-sm flex justify-center items-center bg-gray-100 text-[24px]">
{store?.project?.project && store?.project?.project?.icon ? store?.project?.project?.icon : "😊"}
{store?.project?.project && store?.project?.project?.emoji ? (
renderEmoji(store?.project?.project?.emoji)
) : (
<Image src="/plane-logo.webp" alt="plane logo" className="w-[24px] h-[24px]" height="24" width="24" />
)}
</div>
<div className="font-medium text-lg max-w-[300px] line-clamp-1 overflow-hidden">
{store?.project?.project?.name || `...`}
Expand Down
2 changes: 1 addition & 1 deletion apps/space/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "plane-space",
"name": "plane-deploy",
"version": "0.0.1",
"private": true,
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions apps/space/store/types/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface IProject {
id: string;
identifier: string;
name: string;
description: string;
icon: string;
cover_image: string | null;
icon_prop: string | null;
Expand Down

0 comments on commit 1ded8f4

Please sign in to comment.