Skip to content
Merged
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
7 changes: 6 additions & 1 deletion app/characters/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ export default async function CharacterPage({
const characterSuggestions = allCharacters
.map((c) => c.frontmatter)
.filter((f) => !f.draft && !f.placeholder)
.map((f) => ({ slug: f.slug, name: f.name, alias: f.aliases[0] ?? null }));
.map((f) => ({
slug: f.slug,
name: f.name,
alias: f.aliases[0] ?? null,
aliases: f.aliases,
}));

const primaryHouse = fm["primary-house"]
? housesBySlug.get(fm["primary-house"])
Expand Down
1 change: 1 addition & 0 deletions app/characters/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default async function CharactersPage() {
slug: c.frontmatter.slug,
name: c.frontmatter.name,
alias: c.frontmatter.aliases[0] ?? null,
aliases: c.frontmatter.aliases,
primaryHouseSlug: c.frontmatter["primary-house"],
region: regionForHouse(c.frontmatter["primary-house"], housesBySlug),
portrait: portraits[i],
Expand Down
18 changes: 17 additions & 1 deletion components/CharacterSearchInput/CharacterSearchInput.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ function asInput(el: HTMLElement): HTMLInputElement {
}

const items: CharacterSuggestion[] = [
{ slug: "naerys-targaryen", name: "Naerys Targaryen", alias: null },
{
slug: "naerys-targaryen",
name: "Naerys Targaryen",
alias: null,
aliases: [],
},
{
slug: "aemon-targaryen",
name: "Aemon Targaryen",
alias: "The Dragonknight",
aliases: ["The Dragonknight"],
},
{
slug: "aegon-iv-targaryen",
name: "Aegon IV Targaryen",
alias: "The Unworthy",
aliases: ["The Unworthy"],
},
];

Expand Down Expand Up @@ -103,4 +110,13 @@ describe("CharacterSearchInput — autocomplete mode", () => {
render(<CharacterSearchInput autocomplete items={items} />);
expect(screen.queryByRole("listbox")).toBeNull();
});

it("matches on alias when the query doesn't appear in the name", () => {
render(<CharacterSearchInput autocomplete items={items} />);
const input = screen.getByRole("combobox");
fireEvent.change(input, { target: { value: "dragonknight" } });
const options = screen.getAllByRole("option");
expect(options).toHaveLength(1);
expect(options[0]?.textContent).toContain("Aemon Targaryen");
});
});
1 change: 1 addition & 0 deletions components/CharacterSearchInput/CharacterSearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type CharacterSuggestion = {
slug: string;
name: string;
alias: string | null;
aliases: string[];
};

type CommonProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const items: CharacterItem[] = [
slug: "arya-stark",
name: "Arya Stark",
alias: null,
aliases: [],
primaryHouseSlug: "stark",
region: "north",
portrait: "/characters/arya-stark.png",
Expand All @@ -24,6 +25,7 @@ const items: CharacterItem[] = [
slug: "eddard-stark",
name: "Eddard Stark",
alias: null,
aliases: [],
primaryHouseSlug: "stark",
region: "north",
portrait: "/characters/eddard-stark.png",
Expand All @@ -32,6 +34,7 @@ const items: CharacterItem[] = [
slug: "tywin-lannister",
name: "Tywin Lannister",
alias: null,
aliases: [],
primaryHouseSlug: "lannister",
region: "westerlands",
portrait: "/characters/tywin-lannister.png",
Expand All @@ -43,6 +46,7 @@ function manyItems(n: number): CharacterItem[] {
slug: `c-${String(i).padStart(3, "0")}`,
name: `Char ${String(i).padStart(3, "0")}`,
alias: null,
aliases: [],
primaryHouseSlug: "stark",
region: "north",
portrait: "/characters/unknown-male.png",
Expand Down Expand Up @@ -98,6 +102,7 @@ describe("FilteredCharacterList", () => {
slug: "x",
name: "X",
alias: null,
aliases: [],
primaryHouseSlug: "unknown",
region: null,
portrait: "/characters/unknown-male.png",
Expand All @@ -116,6 +121,7 @@ describe("FilteredCharacterList", () => {
slug: "aegon-i",
name: "Aegon I Targaryen",
alias: "The Conqueror",
aliases: [],
primaryHouseSlug: "targaryen",
region: "crownlands",
portrait: "/characters/aegon-i-targaryen.png",
Expand All @@ -124,6 +130,7 @@ describe("FilteredCharacterList", () => {
slug: "aegon-iv",
name: "Aegon IV Targaryen",
alias: "The Unworthy",
aliases: [],
primaryHouseSlug: "targaryen",
region: "crownlands",
portrait: "/characters/aegon-iv-targaryen.png",
Expand Down Expand Up @@ -155,6 +162,7 @@ describe("FilteredCharacterList", () => {
slug: "aegon-i",
name: "Aegon I Targaryen",
alias: "The Conqueror",
aliases: [],
primaryHouseSlug: "targaryen",
region: "crownlands",
portrait: "/characters/aegon-i-targaryen.png",
Expand Down Expand Up @@ -425,6 +433,7 @@ describe("FilteredCharacterList", () => {
slug: "arya-stark",
name: "Arya Stark",
alias: null,
aliases: [],
primaryHouseSlug: "stark",
region: "north",
portrait: "/characters/arya-stark.png",
Expand Down
1 change: 1 addition & 0 deletions components/FilteredCharacterList/FilteredCharacterList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type CharacterItem = {
slug: string;
name: string;
alias: string | null;
aliases: string[];
primaryHouseSlug: string | null;
region: string | null;
portrait: string;
Expand Down
2 changes: 2 additions & 0 deletions content/characters/aegon-i-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ titles:
aliases:
- The Conqueror
- The Dragon
- The Dragonlord
- Of Dragonstone
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aegon_I_Targaryen
Expand Down
3 changes: 3 additions & 0 deletions content/characters/aegon-iii-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ aliases:
- The Dragonbane
- The Broken King
- The Unlucky
- The Younger
- The Unhappy
- The Uncrowned King
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aegon_III_Targaryen
Expand Down
1 change: 1 addition & 0 deletions content/characters/aegon-son-of-rhaegar.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ titles:
- Prince
aliases:
- Young Griff
- The Prince That Was Promised
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aegon_Targaryen_(son_of_Rhaegar)
Expand Down
1 change: 1 addition & 0 deletions content/characters/aegon-the-uncrowned.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ titles:
- Prince of Dragonstone
aliases:
- The Uncrowned
- The Pretender
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aegon_Targaryen_(son_of_Aenys_I)
Expand Down
2 changes: 2 additions & 0 deletions content/characters/aegon-v-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ titles:
aliases:
- The Unlikely
- Egg
- The Fortunate
- The Prince Who Was An Egg
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aegon_V_Targaryen
Expand Down
2 changes: 2 additions & 0 deletions content/characters/aemon-targaryen-maester.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ died:
era: AC
precision: year
primary-house: targaryen
aliases:
- "Uncle Maester"
parents:
- maekar-i-targaryen
- dyanna-dayne
Expand Down
1 change: 1 addition & 0 deletions content/characters/aemon-the-dragonknight.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ titles:
- Lord Commander of the Kingsguard
aliases:
- The Dragonknight
- The Knight of Tears
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aemon_the_Dragonknight
Expand Down
1 change: 1 addition & 0 deletions content/characters/aenar-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ titles:
- Lord of Dragonstone
aliases:
- The Exile
- The Lord who Left
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aenar_Targaryen
Expand Down
4 changes: 4 additions & 0 deletions content/characters/aerion-targaryen-brightflame.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ titles:
- Prince
aliases:
- Brightflame
- Brightfire
- Aerion the Monstrous
- The Prince Who Thought He Was a Dragon
- The Bright Prince
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aerion_Targaryen
Expand Down
4 changes: 4 additions & 0 deletions content/characters/aerys-ii-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ titles:
aliases:
- The Mad King
- Aerys II
- Mad King Aerys
- King Scab
- Aerys the Mad
- Mad Aerys
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Aerys_II_Targaryen
Expand Down
2 changes: 2 additions & 0 deletions content/characters/alicent-hightower.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ children:
titles:
- Queen of the Seven Kingdoms
- Queen Dowager
aliases:
- The Queen in Chains
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Alicent_Hightower
Expand Down
4 changes: 4 additions & 0 deletions content/characters/alyn-velaryon.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ titles:
aliases:
- Oakenfist
- Alyn of Hull
- Alyn Oakenfist
- Alyn the Oakenfist
- Lord Oakenfist
- Hero of the Stepstones
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Alyn_Velaryon
Expand Down
2 changes: 2 additions & 0 deletions content/characters/alys-harroway.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ also-of-houses:
- targaryen
spouses:
- maegor-i-targaryen
aliases:
- "Maegor's Whore"
titles:
- Queen of the Seven Kingdoms
sources:
Expand Down
2 changes: 2 additions & 0 deletions content/characters/alys-rivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ died: null
primary-house: strong
parents:
- lyonel-strong
aliases:
- Witch Queen
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Alys_Rivers
Expand Down
2 changes: 2 additions & 0 deletions content/characters/alysanne-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ titles:
- Rider of Silverwing
aliases:
- The Good Queen
- The Little Maid
- The Other Daughter
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Alysanne_Targaryen
Expand Down
2 changes: 2 additions & 0 deletions content/characters/arryk-cargyll.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ died:
primary-house: cargyll
titles:
- Kingsguard
aliases:
- One of the Celebrated Cargyll Twins
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Arryk_Cargyll
Expand Down
22 changes: 22 additions & 0 deletions content/characters/arya-stark.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,28 @@ primary-house: stark
parents:
- eddard-stark
- catelyn-stark
aliases:
- "Arya Horseface"
- "Arya Underfoot"
- "Arry"
- "Lumpyhead"
- "Lumpyface"
- "Stickboy"
- "Rabbitkiller"
- "Weasel"
- "The ghost in Harrenhal"
- "Nan"
- "Squab"
- "Squirrel"
- "Wolf girl"
- "Salty"
- "Cat of the Canals"
- "Blind Beth"
- "The blind girl"
- "The night wolf"
- "The ugly girl"
- "Mercedene"
- "Mercy"
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Arya_Stark
Expand Down
3 changes: 3 additions & 0 deletions content/characters/asha-greyjoy.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ spouses:
titles:
- Captain of the Black Wind
- Princess of the Iron Islands
aliases:
- Esgred
- The Kraken's Daughter
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Asha_Greyjoy
Expand Down
1 change: 1 addition & 0 deletions content/characters/ashara-dayne.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ titles:
- Lady
aliases:
- Lady Ashara
- The maid with laughing purple eyes
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Ashara_Dayne
Expand Down
3 changes: 3 additions & 0 deletions content/characters/baela-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ titles:
- Princess
- Lady of Driftmark
- Rider of Moondancer
aliases:
- Baela Velaryon
- Dragon Twin
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Baela_Targaryen
Expand Down
2 changes: 2 additions & 0 deletions content/characters/baelon-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ titles:
- Rider of Vhagar
aliases:
- The Brave
- The Spring Prince
- The Silver Fool
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Baelon_Targaryen
Expand Down
1 change: 1 addition & 0 deletions content/characters/baelor-breakspear-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ titles:
- Hand of the King
aliases:
- Breakspear
- The Hammer
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Baelor_Targaryen
Expand Down
1 change: 1 addition & 0 deletions content/characters/baelor-i-targaryen.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ aliases:
- The Blessed
- The Beloved
- The Septon King
- The Befuddled
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Baelor_I_Targaryen
Expand Down
5 changes: 5 additions & 0 deletions content/characters/balon-greyjoy.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ aliases:
- The Twice Crowned
- Balon the Brave
- Balon the Widowmaker
- The Wet King
- The Kraken King
- The Iron King
- Balon the Bold
- Balon the Blessed
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Balon_Greyjoy
Expand Down
3 changes: 3 additions & 0 deletions content/characters/barristan-selmy.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ titles:
aliases:
- Barristan the Bold
- Arstan Whitebeard
- Barristan the Old
- Ser Grandfather
- Old Ser
sources:
- type: awoiaf
url: https://awoiaf.westeros.org/index.php/Barristan_Selmy
Expand Down
Loading
Loading