Skip to content

Commit

Permalink
chore: add single team page
Browse files Browse the repository at this point in the history
  • Loading branch information
silviyaboteva committed Feb 28, 2025
1 parent 373f08f commit 07093ac
Show file tree
Hide file tree
Showing 4 changed files with 446 additions and 142 deletions.
2 changes: 2 additions & 0 deletions examples/kendo-react-freemium/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Home from "./pages/Home";
import Projects from "./pages/Projects";
import Tasks from "./pages/Tasks";
import Settings from "./pages/Settings";
import Team from "./pages/Team";

export default function App() {
return (
Expand All @@ -18,6 +19,7 @@ export default function App() {
<Route path="/projects" element={<Projects />} />
<Route path="/tasks" element={<Tasks />} />
<Route path="/team-management" element={<TeamManagement />} />
<Route path="/team-management/:teamId" element={<Team />} />
<Route path="/settings" element={<Settings />} />
</Routes>
</DrawerComponent>
Expand Down
106 changes: 106 additions & 0 deletions examples/kendo-react-freemium/src/pages/Team.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { useParams } from "react-router";
import { useNavigate } from "react-router-dom";
import { teamsData } from "./data";
import { ButtonGroup, Button, ChipList, ChipProps, Chip, FloatingActionButton } from "@progress/kendo-react-buttons";
import { Breadcrumb, StackLayout, Card, CardBody, Avatar, CardTitle, CardSubtitle, CardFooter, BreadcrumbLinkMouseEvent } from "@progress/kendo-react-layout";
import { groupIcon, listUnorderedSquareIcon, checkIcon, chevronRightIcon, homeIcon, detailSectionIcon, pencilIcon, plusIcon } from "@progress/kendo-svg-icons";
import { SvgIcon } from "@progress/kendo-react-common";
import React from "react";

interface DataModel {
id: string;
text?: string;
icon?: React.ReactNode;
}

export default function Team() {
let params = useParams();
const navigate = useNavigate();
const [isGridView, setIsGridView] = React.useState(true);
const team = teamsData.filter(team => team.teamCode === params.teamId)[0];

const breadcrumbItems: DataModel[] = [
{
id: "home",
icon: <SvgIcon icon={homeIcon} />,
},
{
id: "team-management",
text: "Team Management",
},
{
id: `${params.teamId}`,
text: `${teamsData.filter(team => team.teamCode === params.teamId)[0].teamName}`,
}
];

const handleItemSelect = (e: BreadcrumbLinkMouseEvent) => {
if (e.id === 'home') {
navigate('/');
} else if (e.id === 'team-management') {
navigate('/team-management');
}
}

const handleViewChange = (view: 'grid' | 'list') => {
if (view === 'grid') {
setIsGridView(true);
} else {
setIsGridView(false);
}
};

const getInitials = (fullName: string) => {
const nameParts = fullName.split(" ");
const firstNameInitial = nameParts[0].charAt(0).toUpperCase();
const lastNameInitial = nameParts[1].charAt(0).toUpperCase();
return firstNameInitial + lastNameInitial;
}

return (
<>
<div style={{minHeight: 'calc(100vh - 106px)'}} className="flex flex-col p-10 gap-6">
<Breadcrumb data={breadcrumbItems} onItemSelect={handleItemSelect} className="!bg-app-surface" />

<div>
<h1 className="text-4xl">{teamsData.map(team => { return team.teamCode === params.teamId ? team.teamName : '' })}</h1>
<h5 className="text-subtle">{teamsData.map(team => { return team.teamCode === params.teamId ? team.teamMembers.length : '' })} team members</h5>
</div>

<div className="flex justify-between items-start gap-6">
<ButtonGroup>
<Button svgIcon={groupIcon} togglable={true} selected={isGridView}
onClick={() => handleViewChange('grid')} />
<Button svgIcon={listUnorderedSquareIcon} togglable={true} selected={!isGridView}
onClick={() => handleViewChange('list')} />
</ButtonGroup>
</div>

<StackLayout className={`grid ${isGridView ? 'grid-cols-2' : 'grid-cols-1'} ${isGridView ? 'lg:grid-cols-4' : 'lg:grid-cols-1'}`} orientation="horizontal" style={{ gap: "var(--kendo-spacing-4) var(--kendo-spacing-6)" }}>
{team.teamMembers.map((member, index) => {
return <Card key={index}>
<CardBody className="flex items-center">
<Avatar className="bg-[#008B8B]">{getInitials(member.teamMember)}</Avatar>
<div className="overflow-hidden">
<CardTitle className="font-medium truncate">{member.teamMember}</CardTitle>
<CardSubtitle className="text-subtle m-0 truncate">{member.title}</CardSubtitle>
</div>
<Button svgIcon={pencilIcon} fillMode="flat" className="ml-auto" />
</CardBody>
<CardFooter className="border-0 p-2">
<Button svgIcon={detailSectionIcon} fillMode="flat">Details</Button>
</CardFooter>
</Card>
})}
</StackLayout>

<div className="flex justify-end mt-auto">
<FloatingActionButton svgIcon={plusIcon} text="Add new member" size="small" alignOffset={{ x: 40, y: 75 }}/>
</div>
</div>
<div className="bg-surface-alt color-subtle p-2 text-center">
<span>Copyright &#169; 2025 Progress Software. All rights reserved.</span>
</div>
</>
)
}
145 changes: 3 additions & 142 deletions examples/kendo-react-freemium/src/pages/TeamManagement.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Layout } from "@progress/kendo-drawing";
import { ButtonGroup, Button, ChipList, Chip, ChipProps, ChipListChangeEvent } from "@progress/kendo-react-buttons";
import { SvgIcon } from "@progress/kendo-react-common";
import { Breadcrumb, Card, CardBody, Avatar, CardTitle, CardSubtitle, CardFooter, BreadcrumbLinkMouseEvent, StackLayout } from "@progress/kendo-react-layout";
import { checkIcon, chevronRightIcon, groupIcon, homeIcon, listUnorderedSquareIcon } from "@progress/kendo-svg-icons";
import React from "react";
import { useNavigate } from "react-router-dom";
import { teamsChips, teamsData } from "./data";

interface DataModel {
id: string;
Expand All @@ -23,144 +23,6 @@ const breadcrumbItems: DataModel[] = [
}
];

const teamsChips = [
{ text: "All", value: 'all', disabled: false },
{ text: "Technology and Developement", value: 'technology', disabled: true },
{ text: "Product and Design", value: 'product', disabled: true },
{ text: "Business Operation", value: 'business', disabled: true },
{ text: "Marketing and Sales", value: 'marketing', disabled: true },
];

const teamsData = [
{
teamCode: 'FE',
teamName: 'Frontend team',
teamMembers: '10 members',
avatarColor: '#9C38FF',
group: 'technology'
},
{
teamCode: 'BE',
teamName: 'Backend Team',
teamMembers: '10 members',
avatarColor: '#800000',
group: 'technology'
},
{
teamCode: 'DO',
teamName: 'DevOps Team',
teamMembers: '10 members',
avatarColor: '#333333',
group: 'technology'
},
{
teamCode: 'QA',
teamName: 'QA Team',
teamMembers: '10 members',
avatarColor: '#218247',
group: 'technology'
},
{
teamCode: 'UX',
teamName: 'UX/UI Design Team',
teamMembers: '10 members',
avatarColor: '#DB0000',
group: 'product'
},
{
teamCode: 'DB',
teamName: 'Database Team',
teamMembers: '10 members',
avatarColor: '#8F7200',
group: 'technology'
},
{
teamCode: 'М',
teamName: 'Marketing Team',
teamMembers: '10 members',
avatarColor: '#008B8B',
group: 'marketing'
},
{
teamCode: 'PM',
teamName: 'Product Management Team',
teamMembers: '10 members',
avatarColor: '#C14E34',
group: 'product'
},
{
teamCode: 'TS',
teamName: 'Technical Support Team',
teamMembers: '10 members',
avatarColor: '#027EB5',
group: 'technology'
},
{
teamCode: 'S',
teamName: 'Security Team',
teamMembers: '10 members',
avatarColor: '#267B92',
group: 'technology'
},
{
teamCode: 'DS',
teamName: 'Data Science Team',
teamMembers: '10 members',
avatarColor: '#708090',
group: 'technology'
},
{
teamCode: 'IE',
teamName: 'Infrastructure Engineering',
teamMembers: '10 members',
avatarColor: '#191970',
group: 'technology'
},
{
teamCode: 'RD',
teamName: 'Research and Development',
teamMembers: '10 members',
avatarColor: '#7B3F00',
group: 'technology'
},
{
teamCode: 'BA',
teamName: 'Business Analysis Team',
teamMembers: '10 members',
avatarColor: '#607F1F',
group: 'business'
},
{
teamCode: 'TW',
teamName: 'Technical Writing Team',
teamMembers: '10 members',
avatarColor: '#DC147F',
group: 'business'
},
{
teamCode: 'S',
teamName: 'Sales Team',
teamMembers: '10 members',
avatarColor: '#5769D2',
group: 'marketing'
},
{
teamCode: 'SA',
teamName: 'System Administration',
teamMembers: '10 members',
avatarColor: '#4682B4',
group: 'technology'
},
{
teamCode: 'CG',
teamName: 'Compliance and Governance',
teamMembers: '10 members',
avatarColor: '#4B0082',
group: 'business'
}
];


export default function TeamManagement() {
const navigate = useNavigate();
const [chipValue, setChipValue] = React.useState<string[]>(['all']);
Expand All @@ -185,7 +47,6 @@ export default function TeamManagement() {
setIsGridView(false);
}
};
console.log(chipValue)

return (
<>
Expand Down Expand Up @@ -222,11 +83,11 @@ export default function TeamManagement() {
<Avatar style={{ background: team.avatarColor }}>{team.teamCode}</Avatar>
<div className="overflow-hidden">
<CardTitle className="font-medium truncate">{team.teamName}</CardTitle>
<CardSubtitle className="text-subtle m-0 truncate">{team.teamMembers}</CardSubtitle>
<CardSubtitle className="text-subtle m-0 truncate">{team.teamMembers.length} team members</CardSubtitle>
</div>
</CardBody>
<CardFooter className="border-0 p-2">
<Button svgIcon={chevronRightIcon} fillMode="flat">Explore team</Button>
<Button svgIcon={chevronRightIcon} fillMode="flat" onClick={() => navigate(`/team-management/${team.teamCode}`)}>Explore team</Button>
</CardFooter>
</Card>
})}
Expand Down
Loading

0 comments on commit 07093ac

Please sign in to comment.