-
+
@@ -166,31 +172,60 @@ import ModalInput from "./utils/ModalInput.astro";
const ul = maintainersList.querySelector("ul");
if (ul) {
ul.innerHTML = '';
- projectInfo.maintainers.forEach((maintainer: string) => {
- const li = document.createElement("li");
- li.className = "relative";
-
- const content = document.createElement("p");
- content.className = "truncate";
- content.textContent = maintainer;
-
- li.appendChild(content);
-
- const popup = document.createElement("p");
- popup.className = "absolute left-0 bottom-full mb-1 bg-black text-white text-xs text-center p-1 rounded hidden before:content-[''] before:absolute before:left-1/2 before:top-full before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-black max-w-[240px] sm:max-w-[320px] md:max-w-none break-words";
- popup.textContent = maintainer;
- li.appendChild(popup);
-
- li.addEventListener("mouseenter", () => {
- popup.classList.remove("hidden");
+ const configData = loadConfigData();
+ if (configData && configData.authorGithubNames && configData.maintainersAddresses) {
+ configData.authorGithubNames.forEach((authorName: string, index: number) => {
+ const li = document.createElement("li");
+ li.className = "relative";
+
+ const content = document.createElement("p");
+ content.className = "truncate";
+ content.textContent = authorName;
+
+ li.appendChild(content);
+
+ const popup = document.createElement("p");
+ popup.className = "absolute left-0 bottom-full mb-1 bg-black text-white text-xs text-center p-1 rounded hidden before:content-[''] before:absolute before:left-5 before:top-full before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-black max-w-[240px] sm:max-w-[320px] md:max-w-none break-words";
+ popup.textContent = configData.maintainersAddresses[index] || '';
+ li.appendChild(popup);
+
+ li.addEventListener("mouseenter", () => {
+ popup.classList.remove("hidden");
+ });
+
+ li.addEventListener("mouseleave", () => {
+ popup.classList.add("hidden");
+ });
+
+ ul.appendChild(li);
});
-
- li.addEventListener("mouseleave", () => {
- popup.classList.add("hidden");
+ } else {
+ projectInfo.maintainers.forEach((maintainer: string) => {
+ const li = document.createElement("li");
+ li.className = "relative";
+
+ const content = document.createElement("p");
+ content.className = "truncate";
+ content.textContent = maintainer;
+
+ li.appendChild(content);
+
+ const popup = document.createElement("p");
+ popup.className = "absolute left-0 bottom-full mb-1 bg-black text-white text-xs text-center p-1 rounded hidden before:content-[''] before:absolute before:left-1/2 before:top-full before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-black max-w-[240px] sm:max-w-[320px] md:max-w-none break-words";
+ popup.textContent = maintainer;
+ li.appendChild(popup);
+
+ li.addEventListener("mouseenter", () => {
+ popup.classList.remove("hidden");
+ });
+
+ li.addEventListener("mouseleave", () => {
+ popup.classList.add("hidden");
+ });
+
+ ul.appendChild(li);
});
-
- ul.appendChild(li);
- });
+ }
}
}
const githubLink = document.getElementById("github-link") as HTMLAnchorElement;
@@ -282,12 +317,13 @@ import ModalInput from "./utils/ModalInput.astro";
}
const viewCommitHistory = document.getElementById("view-commit-history");
+ const jumpToLatestCommit = document.getElementById("jump-to-latest-commit");
const viewCommitText = document.getElementById("view-commit-text");
const commitHistoryContainer = document.getElementById("commit-history-container");
const commitIconUp = document.getElementById("commit-icon-up");
const commitIconDown = document.getElementById("commit-icon-down");
- if (viewCommitHistory && viewCommitText && commitHistoryContainer && commitIconUp && commitIconDown) {
+ if (viewCommitHistory && commitHistoryContainer) {
viewCommitHistory.addEventListener("click", () => {
if (commitHistoryContainer.style.maxHeight === "0px" || !commitHistoryContainer.style.maxHeight) {
commitHistoryContainer.style.maxHeight = `${commitHistoryContainer.scrollHeight}px`;
@@ -295,7 +331,24 @@ import ModalInput from "./utils/ModalInput.astro";
commitHistoryContainer.style.maxHeight = "0px";
}
});
-
+ }
+
+ if (jumpToLatestCommit && commitHistoryContainer) {
+ jumpToLatestCommit.addEventListener("click", () => {
+ if (commitHistoryContainer.style.maxHeight === "0px" || !commitHistoryContainer.style.maxHeight) {
+ commitHistoryContainer.style.maxHeight = `${commitHistoryContainer.scrollHeight}px`;
+ } else {
+ setTimeout(() => {
+ const latestCommit = document.getElementById('latest-commit-record');
+ if (latestCommit) {
+ latestCommit.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+ }, 10);
+ }
+ })
+ }
+
+ if (viewCommitText && commitHistoryContainer && commitIconUp && commitIconDown) {
commitHistoryContainer.addEventListener("transitionend", () => {
if (commitHistoryContainer.style.maxHeight === "0px") {
viewCommitText.textContent = "View Commit History";
@@ -310,7 +363,7 @@ import ModalInput from "./utils/ModalInput.astro";
if (latestCommit) {
latestCommit.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
- }, 1000);
+ }, 10);
}
});
}
@@ -357,7 +410,8 @@ import ModalInput from "./utils/ModalInput.astro";
projectLogo.style.display = 'none';
}
}
- if (projectThumbnail) projectThumbnail.src = configData.thumbnailImageLink || '/fallback-image.jpg';
+ // if (projectThumbnail) projectThumbnail.src = configData.thumbnailImageLink || '/fallback-image.jpg';
+ if (projectThumbnail) projectThumbnail.src = convertGitHubLink(configData.logoImageLink) || '/fallback-image.jpg';
if (projectDescription) projectDescription.textContent = configData.description || '';
if (companyName) companyName.innerHTML = `Developed by `;
diff --git a/dapp/src/components/ProjectList.jsx b/dapp/src/components/ProjectList.jsx
index 0efb111..a35266f 100644
--- a/dapp/src/components/ProjectList.jsx
+++ b/dapp/src/components/ProjectList.jsx
@@ -1,21 +1,29 @@
import React, { useState, useEffect } from 'react';
+import { useStore } from '@nanostores/react';
import ProjectCard from './ProjectCard.jsx';
-import { getDemoConfigData } from '../constants/demoConfigData.js';
import Dropdown from './utils/DropDown.jsx';
-import { refreshLocalStorage, setProjectId } from '../service/StateService';
+import ProjectInfoModal from './utils/ProjectInfoModal.jsx';
+import { getDemoConfigData } from '../constants/demoConfigData';
+import { refreshLocalStorage, setProjectId, loadConfigData } from '../service/StateService';
+import { projectCardModalOpen } from '../utils/store.js';
+import { convertGitHubLink } from '../utils/editLinkFunctions';
const ProjectList = () => {
- const [projects, setProjects] = useState([]);
- const [filteredProjects, setFilteredProjects] = useState([]);
+ const isProjectInfoModalOpen = useStore(projectCardModalOpen);
+ const [projects, setProjects] = useState(undefined);
+ const [filteredProjects, setFilteredProjects] = useState(undefined);
const [searchTerm, setSearchTerm] = useState('');
const [category, setCategory] = useState('all');
- const options = [
- { label: 'All', value: 'all' },
- { label: 'Web', value: 'web' },
- { label: 'Mobile', value: 'mobile' },
- { label: 'Desktop', value: 'desktop' },
- ];
+ const [isModalOpen, setModalOpen] = useState(false);
+ const [projectInfo, setProjectInfo] = useState(null);
+
+ // const options = [
+ // { label: 'All', value: 'all' },
+ // { label: 'Web', value: 'web' },
+ // { label: 'Mobile', value: 'mobile' },
+ // { label: 'Desktop', value: 'desktop' },
+ // ];
useEffect(() => {
const fetchProjects = async () => {
@@ -29,13 +37,30 @@ const ProjectList = () => {
}, []);
useEffect(() => {
- const filtered = projects.filter(project =>
- project?.projectName.toLowerCase().includes(searchTerm.toLowerCase()) &&
- (category === 'all')
- );
- setFilteredProjects(filtered);
+ if (projects) {
+ const filtered = projects.filter(project =>
+ project?.projectName.toLowerCase().includes(searchTerm.toLowerCase()) &&
+ (category === 'all')
+ );
+ setFilteredProjects(filtered);
+ }
}, [searchTerm, category, projects]);
+ useEffect(() => {
+ setModalOpen(isProjectInfoModalOpen);
+ if (isProjectInfoModalOpen) {
+ const configData = loadConfigData();
+ if (configData?.logoImageLink) {
+ setProjectInfo({
+ ...configData,
+ logoImageLink: convertGitHubLink(configData.logoImageLink)
+ });
+ } else {
+ setProjectInfo(configData);
+ }
+ }
+ }, [isProjectInfoModalOpen]);
+
const handleSearch = () => {
console.log('Search function activated');
};
@@ -49,12 +74,12 @@ const ProjectList = () => {
return (
-
setCategory(e.target.value)} />
-
+ {/*
setCategory(e.target.value)} /> */}
+
- {filteredProjects.length === 0 && (
+
+
+ {filteredProjects !== undefined && (
+ filteredProjects.length > 0 ? (
+
+ {filteredProjects.map((project, index) => (
+
+ ))}
+
+ ) : (
+
+ {/*
No projects found
*/}
- )}
-
-
- {filteredProjects.length > 0 ? (
-
- {filteredProjects.map((project, index) => (
-
- ))}
-
- ) : (
-
+
+ )
)}
+
+ {isModalOpen &&
+
projectCardModalOpen.set(false)}/>
+ }
);
};
diff --git a/dapp/src/components/RegisterProject.astro b/dapp/src/components/RegisterProject.astro
index 0f1006f..5fd5f4b 100644
--- a/dapp/src/components/RegisterProject.astro
+++ b/dapp/src/components/RegisterProject.astro
@@ -107,7 +107,7 @@ import ModalInput from "./utils/ModalInput.astro";
if (!register_status) {
alert("Project could not be registered! Please retry.");
} else {
- navigate("/commit");
+ navigate("/project");
}
});
}
diff --git a/dapp/src/components/SetProject.astro b/dapp/src/components/SetProject.astro
index 36d33bb..da53bb4 100644
--- a/dapp/src/components/SetProject.astro
+++ b/dapp/src/components/SetProject.astro
@@ -93,6 +93,8 @@ const TANSU_CONTRACT_ID = import.meta.env.PUBLIC_TANSU_CONTRACT_ID;
telegram: "",
discord: "",
instagram: "",
+ facebook: "",
+ reddit: "",
},
authorGithubNames: tomlData.PRINCIPALS?.map((p: { github: any; }) => p.github) || [],
maintainersAddresses: tomlData.ACCOUNTS || [],
@@ -106,7 +108,7 @@ const TANSU_CONTRACT_ID = import.meta.env.PUBLIC_TANSU_CONTRACT_ID;
if (typeof latestSha === 'string' && latestSha.match(/^[a-f0-9]{40}$/)) {
setProjectLatestSha(latestSha);
} else setProjectLatestSha("");
- navigate("/commit");
+ navigate("/project");
} else {
navigate("/register");
}
diff --git a/dapp/src/components/utils/Modal.jsx b/dapp/src/components/utils/Modal.jsx
new file mode 100644
index 0000000..896649a
--- /dev/null
+++ b/dapp/src/components/utils/Modal.jsx
@@ -0,0 +1,28 @@
+import React from 'react';
+
+const Modal = ({ id, title, children, onClose }) => {
+ return (
+