Skip to content

Commit

Permalink
update clan explorer code
Browse files Browse the repository at this point in the history
  • Loading branch information
xkeshav committed Feb 19, 2025
1 parent 0079bc7 commit fa8e1a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
44 changes: 3 additions & 41 deletions src/components/Card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,7 @@ import "@/assets/styles/card.css";
const cardContainer = document.getElementById("card-container") as HTMLElement;
const searchInput = document.getElementById("searchInput") as HTMLInputElement;

function createKeyValuePairs(branch: Branch, query: string) {
return Object.entries(branch)
.filter(([key]) => ["Caste", "Gotra", "Deity"].includes(key))
.map(([key, value]) => {
let icon = "";
switch (key) {
case "Gotra":
icon = "🧬";
break;
case "Deity":
icon = "🕉";
break;
case "Caste":
icon = "🌿";
break;
default:
icon = "🔑";
}
const highlightedValue = highlightText(value?.hi || "", query);
return `
<p title="${key}"><span data-name="${key}" class="icon">${icon}</span> : <span>${highlightedValue}</span></p>
`;
})
.join("");
}

function createSurnameCards(
surnames: Surname[],
gotra: string,
deity: string,
branchName: string,
query: string
): string {
function createSurnameCards(surnames: Surname[], query: string): string {
return surnames
.filter((surname): surname is Surname => surname?.hi !== undefined && surname?.en !== undefined)
.map(
Expand All @@ -107,14 +75,8 @@ import "@/assets/styles/card.css";
}

function createCardContent(branch: Branch, query: string) {
const keyValueHTML = createKeyValuePairs(branch, query);
const surnamesHTML = createSurnameCards(
branch.Surnames,
branch.Gotra.hi,
branch.Deity.hi,
branch.Caste.hi,
query
);
//const keyValueHTML = createKeyValuePairs(branch, query);
const surnamesHTML = createSurnameCards(branch.Surnames, query);
const surnamesCount = branch.Surnames.length;

return `
Expand Down
1 change: 0 additions & 1 deletion src/pages/about.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
import "@/assets/styles/about.css";
import Help from "@/components/Help.astro";
import BaseLayout from "@/layouts/Base";
---

Expand Down

0 comments on commit fa8e1a1

Please sign in to comment.