creating index for portfolio sites

This commit is contained in:
2025-11-17 23:13:11 -07:00
commit e4cd0735ef
6 changed files with 652 additions and 0 deletions

40
assets/js/data.js Normal file
View File

@@ -0,0 +1,40 @@
const sitesDirectory = [
{
label: "portfolio beta",
url: "https://beta.portfolio.dheerajg.me",
ipv6: ["IPV6 only site"],
remarks: "I'm not a frontend developer but I sometimes use AI for frontend tasks and I dont want to break whats working hence this.",
},
{
label: "portfolio",
url: "https://portfolio.dheerajg.me",
ipv6: ["IPV6 only site"],
remarks: "This is the stable version of my portfolio site.",
},
{
label: "git",
url: "https://git.dheerajg.me",
ipv6: ["IPV6 only site"],
remarks: "well I don't know what to write here apart from its my own git hosting service.",
},
{
label: "resume",
url: "https://resume.dheerajg.me",
ipv4: ["This runs dual stack"],
remarks: "turns out lot of folks still run just IPV4, so made cloudflare tunnel.",
},
{
label: "project documentation",
url: "https://projectdoc.dheerajg.me",
ipv6: ["IPV6 only site"],
remarks: "This is the documentation for my projects, I try to keep it updated I'll try to put some in public .",
},
{
label: "portfolio minimal",
url: "https://v6.min.portfolio.dheerajg.me",
ipv6: ["IPV6 only site"],
remarks: "I have an 15 year old device that isnt able to render modern website so I decided to make a minimal version of my portfolio",
}
];
window.sitesDirectory = sitesDirectory;

88
assets/js/main.js Normal file
View File

@@ -0,0 +1,88 @@
(() => {
const tbody = document.getElementById("sitesBody");
const lastUpdatedEl = document.getElementById("lastUpdated");
const formatTimestamp = () => {
const formatter = new Intl.DateTimeFormat("en", {
dateStyle: "medium",
timeStyle: "short",
});
lastUpdatedEl.textContent = formatter.format(new Date());
};
const renderRows = () => {
if (!Array.isArray(window.sitesDirectory) || !window.sitesDirectory.length) {
tbody.innerHTML = `
<tr>
<td colspan="3">No entries yet. Update assets/js/data.js to get started.</td>
</tr>`;
return;
}
const rows = window.sitesDirectory
.map((site) => {
const {
label = "Site",
url = "#",
ipv4 = [],
ipv6 = [],
remarks = "",
} = site;
const ipv4Badges = ipv4
.map((ip) => `<span class="pill pill--ipv4">${ip}</span>`)
.join("");
const ipv6Badges = ipv6
.map((ip) => `<span class="pill pill--ipv6">${ip}</span>`)
.join("");
const ipMarkup =
ipv4.length || ipv6.length
? `<div class="ip-list">${ipv4Badges}${ipv6Badges}</div>`
: `<span class="remarks">—</span>`;
return `
<tr>
<td>
<a href="${url}" target="_blank" rel="noopener noreferrer">
${label}
</a>
<div class="remarks">${url.replace(/^https?:\/\//, "")}</div>
</td>
<td>${ipMarkup}</td>
<td class="remarks">${remarks}</td>
</tr>`;
})
.join("");
tbody.innerHTML = rows;
};
const initPhotoSizeControls = () => {
const card = document.querySelector(".visual-card");
if (!card) return;
const buttons = card.querySelectorAll("[data-photo-size-option]");
if (!buttons.length) return;
const setSize = (size) => {
card.setAttribute("data-photo-size", size);
buttons.forEach((btn) => {
btn.classList.toggle("is-active", btn.dataset.photoSizeOption === size);
});
};
const initial = card.getAttribute("data-photo-size") || "standard";
setSize(initial);
buttons.forEach((button) => {
button.addEventListener("click", () => {
const size = button.dataset.photoSizeOption;
setSize(size);
});
});
};
formatTimestamp();
renderRows();
initPhotoSizeControls();
})();