-
Notifications
You must be signed in to change notification settings - Fork 3
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
47 team page #48
Merged
Merged
47 team page #48
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
22d00cf
basic team page structure
ann-kilzer 941f374
basic grid
ann-kilzer 0114b2e
building team member card
ann-kilzer 5142c8f
fix unit tests
ann-kilzer be59c1c
add picture and update data
ann-kilzer 758834e
improve team mamber card and add tests
ann-kilzer 86ddd0b
add playwright test
ann-kilzer 402b618
add Daria
ann-kilzer fa922d1
fix localization of names
ann-kilzer f78b556
stylistic fixes and fix i18n export bug
ann-kilzer 5fec9a0
add krizza
ann-kilzer 38068e7
improve e2e test
ann-kilzer 15580b6
e2e test passing
ann-kilzer 3f966f6
test page when switching to japanese
ann-kilzer 6139534
test coverage for english fallback
ann-kilzer 5373310
use smaller image
ann-kilzer af038f7
smaller images
ann-kilzer 9375a4e
adjust playwright to only run on main
ann-kilzer 280b815
add Paty
ann-kilzer 00988aa
Update Ania info
ann-kilzer fc0bfe3
Merge branch 'main' into 47-team-page
ann-kilzer 60918be
lint fixes
ann-kilzer 270e049
fix test name spelling
ann-kilzer 8e9d470
Update Maria and Aidan
ann-kilzer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { test, expect, Locator } from '@playwright/test'; | ||
|
||
/** Verifies visibility of the name, title, and photo | ||
* | ||
* @param card The Locator for the TeamMember Card | ||
* @param name The name to find | ||
* @param title The title to find, if defined | ||
*/ | ||
async function verifyTeamMemberCard(card: Locator, name: string, title?: string) { | ||
await expect(card.getByText(name)).toBeVisible() | ||
if (title) { | ||
await expect(card.getByText(title)).toBeVisible() | ||
} | ||
const photo = card.getByRole('img').first() | ||
await expect(photo).toBeVisible() | ||
await expect(photo).toHaveAttribute('alt-text', `${name} photo`) | ||
} | ||
|
||
test('shows the team in English', async ({ page }) => { | ||
await page.goto('/#/team') | ||
|
||
const teamContainer = page.getByLabel('team-container') | ||
|
||
const heading = teamContainer.getByText('✨ Leadership Team ✨') | ||
await expect(heading).toBeVisible() | ||
|
||
const cards = await teamContainer.getByLabel('team-member-card').all() | ||
expect(cards).toHaveLength(7) | ||
|
||
await verifyTeamMemberCard(cards[0], 'Ann Kilzer', 'Director') | ||
await verifyTeamMemberCard(cards[1], 'Paty Cortez', '') | ||
await verifyTeamMemberCard(cards[2], 'Maria Tenorio', '') | ||
await verifyTeamMemberCard(cards[3], 'Daria Vazhenina', 'ML & Data Science Lead') | ||
await verifyTeamMemberCard(cards[4], 'Krizza Bullecer', 'Lead') | ||
await verifyTeamMemberCard(cards[5], 'Anna Nakayama', '') | ||
await verifyTeamMemberCard(cards[6], 'Aidan Fournier', '') | ||
|
||
// verify link | ||
const links = await page.getByLabel('link-wrapper').all() | ||
expect(links).toHaveLength(1) | ||
const annLink = links[0] | ||
await expect(annLink).toBeVisible() | ||
await expect(annLink).toHaveRole('link') | ||
await expect(annLink).toHaveAttribute('href', 'https://annkilzer.net') | ||
await expect(annLink).toHaveAttribute('target', '_blank') | ||
}); | ||
|
||
test('shows the team in Japanese', async ({ page }) => { | ||
await page.goto('/#/team') | ||
|
||
// switch locale to Japanese | ||
const hamburger = page.getByLabel('drawer-toggle-button') | ||
await hamburger.click() | ||
const japanese = page.getByLabel('drawer').getByText('日本語') | ||
await japanese.click() | ||
|
||
const teamContainer = page.getByLabel('team-container') | ||
|
||
// click off to close sidebar | ||
await teamContainer.click({ force: true }); | ||
|
||
const heading = teamContainer.getByText('✨ リーダーシップ・チーム ✨') | ||
await expect(heading).toBeVisible() | ||
|
||
const cards = await teamContainer.getByLabel('team-member-card').all() | ||
expect(cards).toHaveLength(7) | ||
|
||
await verifyTeamMemberCard(cards[0], 'キルザー·杏', 'ディレクター') | ||
await verifyTeamMemberCard(cards[1], 'Paty Cortez', '') | ||
await verifyTeamMemberCard(cards[2], 'Maria Tenorio', '') | ||
await verifyTeamMemberCard(cards[3], 'バジェニナ・ダリヤ', 'ML&データサイエンス・リード') | ||
await verifyTeamMemberCard(cards[4], 'ブレサー クリザ', 'リード') | ||
await verifyTeamMemberCard(cards[5], 'Anna Nakayama', '') | ||
await verifyTeamMemberCard(cards[6], 'Aidan Fournier', '') | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/components/OptionalLinkWrapper/OptionalLinkWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { FC, ReactNode } from 'react' | ||
|
||
interface OptionalLinkWrapperProps { | ||
url?: string | ||
children: ReactNode | ||
} | ||
|
||
/** | ||
* If url is falsy, returns children. If url is truthy, returns the component wrapped in a link | ||
*/ | ||
const OptionalLinkWrapper: FC<OptionalLinkWrapperProps> = ({ url, children }) => { | ||
if (url) { | ||
return <a href={url} target='_blank' rel="noreferrer" aria-label='link-wrapper'> | ||
{children} | ||
</a> | ||
} | ||
return children | ||
} | ||
|
||
export default OptionalLinkWrapper |
33 changes: 33 additions & 0 deletions
33
src/components/OptionalLinkWrapper/__test__/OptionalLinkWrapper.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { render } from '@/tests/customRender' | ||
import { screen } from '@testing-library/react' | ||
import OptionalLinkWrapper from '../OptionalLinkWrapper' | ||
|
||
|
||
describe('OptionalLinkWrapper', () => { | ||
const exampleURL = 'https://example.com' | ||
|
||
it('should render the link when URL is set', async () => { | ||
render(<OptionalLinkWrapper url={exampleURL}> | ||
<span>child</span> | ||
</OptionalLinkWrapper>) | ||
|
||
const link = await screen.findByRole('link') | ||
expect(link).toHaveAttribute('href', exampleURL) | ||
|
||
const child = await screen.findByText('child') | ||
expect(child).toBeVisible() | ||
}) | ||
|
||
it.each(['', undefined])('should render the child component when URL is %i', async (url: string | undefined) => { | ||
render(<OptionalLinkWrapper url={url}> | ||
<span>child</span> | ||
</OptionalLinkWrapper>) | ||
|
||
const child = await screen.findByText('child') | ||
expect(child).toBeVisible() | ||
|
||
const link = screen.queryByRole('link') | ||
expect(link).toBeNull() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { FC, useEffect, useState } from 'react' | ||
import Card from '@mui/material/Card'; | ||
import CardContent from '@mui/material/CardContent' | ||
import CardMedia from '@mui/material/CardMedia' | ||
import Typography from '@mui/material/Typography' | ||
import TeamMember from '@/types/TeamMember' | ||
import { getI18n } from 'react-i18next' | ||
import OptionalLinkWrapper from '../OptionalLinkWrapper/OptionalLinkWrapper' | ||
|
||
interface TeamMemberCardProps { | ||
member: TeamMember | ||
} | ||
|
||
const TeamMemberCard: FC<TeamMemberCardProps> = ({ member }) => { | ||
const [name, setName] = useState(member.nameEN) | ||
const [title, setTitle] = useState(member.titleEN) | ||
|
||
const i18n = getI18n() | ||
|
||
useEffect(() => { | ||
ann-kilzer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (i18n.language === 'en') { | ||
setName(member.nameEN) | ||
setTitle(member.titleEN) | ||
} else if (i18n.language === 'ja') { | ||
setName(member.nameJA || member.nameEN) | ||
setTitle(member.titleJA || member.titleEN) | ||
} | ||
}, [member, i18n.language]) | ||
|
||
return <OptionalLinkWrapper url={member.url}> | ||
<Card sx={{ height: 420 }} aria-label="team-member-card"> | ||
<CardMedia | ||
sx={{ height: 300, width: 300 }} | ||
image={member.image || 'Placeholder.png'} | ||
title={name} | ||
alt-text={`${name} photo`} | ||
/> | ||
<CardContent> | ||
<Typography variant='h6'> | ||
{name} | ||
</Typography> | ||
<Typography variant="subtitle1"> | ||
{title} | ||
</Typography> | ||
|
||
</CardContent> | ||
</Card> | ||
</OptionalLinkWrapper> | ||
} | ||
|
||
export default TeamMemberCard |
68 changes: 68 additions & 0 deletions
68
src/components/TeamMemberCard/__team__/TeamMemberCard.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { render } from '@/tests/customRender' | ||
import { screen } from '@testing-library/react' | ||
import TeamMemberCard from '../TeamMemberCard' | ||
import TeamMember from '@/types/TeamMember' | ||
import '@/i18n/config' | ||
import i18next from 'i18next' | ||
|
||
|
||
describe('TeamMemberCard', () => { | ||
const member = { | ||
nameEN: 'Alice', | ||
nameJA: 'アリス', | ||
titleEN: 'Lead', | ||
titleJA: 'リード', | ||
image: 'example.png', | ||
url: 'https://example.com' | ||
} as TeamMember | ||
|
||
it('should render a TeamMemberCard in English', async () => { | ||
render(<TeamMemberCard member={member} />) | ||
const name = await screen.findByText(member.nameEN) | ||
expect(name).toBeVisible() | ||
const title = await screen.findByText(member.titleEN) | ||
expect(title).toBeVisible() | ||
const link = await screen.findByRole('link') | ||
expect(link).toHaveAttribute('href', member.url) | ||
const image = await screen.findByRole('img') | ||
expect(image).toBeVisible() | ||
}) | ||
|
||
it('should render a TeamMemberCard in Japanese', async () => { | ||
await i18next.changeLanguage('ja') | ||
render(<TeamMemberCard member={member} />) | ||
|
||
const name = await screen.findByText(member.nameJA) | ||
expect(name).toBeVisible() | ||
const title = await screen.findByText(member.titleJA) | ||
expect(title).toBeVisible() | ||
const link = await screen.findByRole('link') | ||
expect(link).toHaveAttribute('href', member.url) | ||
const image = await screen.findByRole('img') | ||
expect(image).toBeVisible() | ||
}) | ||
|
||
const partialMember = { | ||
nameEN: 'Alice', | ||
nameJA: '', | ||
titleEN: 'Lead', | ||
titleJA: '', | ||
image: 'example.png', | ||
url: 'https://example.com' | ||
} as TeamMember | ||
|
||
it('should render a TeamMemberCard in Japanese and fall back to English when fields are unset', async () => { | ||
await i18next.changeLanguage('ja') | ||
render(<TeamMemberCard member={partialMember} />) | ||
|
||
const name = await screen.findByText(partialMember.nameEN) | ||
expect(name).toBeVisible() | ||
const title = await screen.findByText(partialMember.titleEN) | ||
expect(title).toBeVisible() | ||
const link = await screen.findByRole('link') | ||
expect(link).toHaveAttribute('href', member.url) | ||
const image = await screen.findByRole('img') | ||
expect(image).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
{ | ||
"header": { | ||
"codeOfConduct": "Code of Conduct", | ||
"subtitle": "Women in Software Engineering Japan" | ||
"subtitle": "Women in Software Engineering Japan", | ||
"team": "Team" | ||
}, | ||
"home": { | ||
"helloWorld": "✨ Hello World ✨", | ||
"joinUs": "✨ Join us on Slack ✨", | ||
"paragraph1": "Many of us were saddened to hear of the sudden closure of Women Who Code. There is a need for an organization to empower diverse women in technology careers in Tokyo and across Japan.", | ||
"paragraph2": "We are not giving up on this mission. Please join us in rebuilding community so that we can empower women in Japan in Software Engineering careers.", | ||
"paragraph3": "Our events target professional women in software careers with 2+ years of experience. Beginners to seasoned professionals are welcome to participate. While this organization focuses on women, all genders are welcome at our events. Software-adjacent roles like Data Science, Product, UI/UX, Machine Learning, etc., are welcome, too." | ||
}, | ||
"sidebar": { | ||
"codeOfConduct": "Code of Conduct", | ||
"team": "Team" | ||
}, | ||
"team": { | ||
"title": "✨ Leadership Team ✨" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
{ | ||
"header": { | ||
"codeOfConduct": "行動規範", | ||
"subtitle": "ウーマン・イン・ソフトウェアエンジニアリング" | ||
"subtitle": "ウーマン・イン・ソフトウェアエンジニアリング", | ||
"team": "チーム" | ||
}, | ||
"home": { | ||
"helloWorld": "✨ Hello 世界 ✨", | ||
"joinUs": "✨ スラックに参加する ✨", | ||
"paragraph1": "Women Who Code(WWCode)の活動中止のニュースに対し、多くの人々が悲しみました。東京や日本全体で、IT業界の多様な女性を支援する組織が必要とされています。", | ||
"paragraph2": "この使命を諦めるつもりはありません。WWCodeの志を引き継ぐために、日本の女性がソフトウェアエンジニアとしてキャリアを築けるよう、私たちと共にコミュニティを再構築していきます。", | ||
"paragraph3": "私たちのイベントは、2年以上の経験を持つITプロフェッショナルの女性を中心に、新卒からベテランまでどなたでも参加できるイベントをやっています。この組織は女性に焦点を当てていますが、イベントにはすべてのジェンダーの方が歓迎されています。また、データサイエンティスト、プロダクトマネジャー、UI/UXデザイナー、機械学習エンジニアなどのソフトウェアに関連した役割も歓迎いたします。" | ||
}, | ||
"sidebar": { | ||
"codeOfConduct": "Code of Conduct", | ||
"team": "チーム" | ||
}, | ||
"team": { | ||
"title": "✨ リーダーシップ・チーム ✨" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sirbully good call, I changed all images to JPG and it's way lighter