Skip to content
Open
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
43 changes: 43 additions & 0 deletions src/api/team.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as fs from 'fs'
import matter from 'gray-matter'
import path from 'path'
import { z } from 'zod'

const teamDirectoryPath = path.join(process.cwd(), '/src/data/team')

const schema = z.object({
id: z.string(),
firstName: z.string(),
lastName: z.string(),
avatar: z.string().url(),
bio: z.string().optional().nullable(),
jobName: z.string().optional().nullable(),
jobPosition: z.string().optional().nullable(),
telegram: z.string(),
email: z.string().email().optional().nullable(),
})

export type OrgTeamMember = z.infer<typeof schema>

let orgTeamMembers: readonly OrgTeamMember[] | null = null

export function getOrgTeamMembers(): readonly OrgTeamMember[] {
if (orgTeamMembers !== null) {
return orgTeamMembers
}

const fileNames = fs.readdirSync(teamDirectoryPath)

return (orgTeamMembers = fileNames.map((fileName) => {
const fullPath = path.join(teamDirectoryPath, fileName)
const id = fileName.replace(/\.md$/, '')
const file = fs.readFileSync(fullPath, 'utf-8')
const matterResult = matter(file)

return schema.parse({
id,
...matterResult.data,
bio: matterResult.content,
})
}))
}
19 changes: 19 additions & 0 deletions src/app/(main)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,21 @@ export default function MainLayout({
>
Доклады
</Link>
<Link
href="/team"
className="text-base font-medium text-white hover:text-indigo-50"
>
Команда
</Link>
</div>
</div>

<Link
href="/talks/how-to"
className="text-base font-medium text-white hover:text-indigo-50"
>
Стать спикером

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Стать спикером
Стать докладчиком

Может так?

</Link>
</div>
<div className="py-4 flex flex-wrap justify-center space-x-6 lg:hidden">
<Link
Expand All @@ -47,6 +60,12 @@ export default function MainLayout({
>
Доклады
</Link>
<Link
href="/team"
className="text-base font-medium text-white hover:text-indigo-50"
>
Команда
</Link>
</div>
</nav>
</header>
Expand Down
Loading