feat: show projects link when not own any projects (#104)

This commit is contained in:
Takeshi Kimata
2024-11-21 22:23:12 +09:00
committed by GitHub
parent 85b6285cd3
commit 19889e0b03
4 changed files with 19 additions and 5 deletions

View File

@@ -111,7 +111,9 @@
"your_projects": "Your Projects", "your_projects": "Your Projects",
"public": "Public", "public": "Public",
"private": "Private", "private": "Private",
"no_projects_found": "No projects found" "no_projects_found": "No projects found",
"not_own_any_projects": "You don't own any projects.",
"find_projects": "Find projects"
}, },
"Admin": { "Admin": {
"user_management": "User Management", "user_management": "User Management",

View File

@@ -112,7 +112,8 @@
"your_projects": "保有プロジェクト", "your_projects": "保有プロジェクト",
"public": "パブリック", "public": "パブリック",
"private": "プライベート", "private": "プライベート",
"no_projects_found": "プロジェクトがありません" "not_own_any_projects": "所有しているプロジェクトがありません。",
"find_projects": "プロジェクトを探す"
}, },
"Admin": { "Admin": {
"user_management": "ユーザー管理", "user_management": "ユーザー管理",

View File

@@ -1,19 +1,21 @@
'use client'; 'use client';
import { useState, useEffect, useContext } from 'react'; import { useState, useEffect, useContext } from 'react';
import { Link, NextUiLinkClasses } from '@/src/navigation'; import { Link, NextUiLinkClasses } from '@/src/navigation';
import { Card, CardHeader, CardFooter } from '@nextui-org/react'; import { Button, Card, CardHeader, CardFooter } from '@nextui-org/react';
import { TokenContext } from '@/utils/TokenProvider'; import { TokenContext } from '@/utils/TokenProvider';
import Avatar from 'boring-avatars'; import Avatar from 'boring-avatars';
import { fetchMyProjects } from '@/utils/projectsControl'; import { fetchMyProjects } from '@/utils/projectsControl';
import { ProjectType } from '@/types/project'; import { ProjectType } from '@/types/project';
import PublicityChip from '@/components/PublicityChip'; import PublicityChip from '@/components/PublicityChip';
import { LocaleCodeType } from '@/types/locale'; import { LocaleCodeType } from '@/types/locale';
import { ArrowRight } from 'lucide-react';
type AccountPageMessages = { type AccountPageMessages = {
yourProjects: string; yourProjects: string;
public: string; public: string;
private: string; private: string;
noProjectsFound: string; notOwnAnyProjects: string;
findProjects: string;
}; };
type Props = { type Props = {
@@ -82,7 +84,14 @@ export default function AccountPage({ messages, locale }: Props) {
); );
}) })
) : ( ) : (
<div className="text-default-500">{messages.noProjectsFound}</div> <>
<span className="text-default-500 me-2">{messages.notOwnAnyProjects}</span>
<Link href={`/projects/`} locale={locale} className={NextUiLinkClasses}>
<Button variant="flat" size="sm" endContent={<ArrowRight size={12} />}>
{messages.findProjects}
</Button>
</Link>
</>
)} )}
</div> </div>
</div> </div>

View File

@@ -10,6 +10,8 @@ export default function Page({ params }: PageType) {
public: t('public'), public: t('public'),
private: t('private'), private: t('private'),
noProjectsFound: t('no_projects_found'), noProjectsFound: t('no_projects_found'),
notOwnAnyProjects: t('not_own_any_projects'),
findProjects: t('find_projects'),
}; };
return <AccountPage messages={messages} locale={params.locale as LocaleCodeType} />; return <AccountPage messages={messages} locale={params.locale as LocaleCodeType} />;