Upload 3 files
Browse files- js/pages/AreaPage.js +33 -35
- js/pages/HomePage.js +52 -35
- js/pages/ResourcesPage.js +17 -20
js/pages/AreaPage.js
CHANGED
|
@@ -4,6 +4,7 @@ import { featuredArtifacts } from '../data/artifacts.js';
|
|
| 4 |
import { createArtifactCarousel } from '../cards/ArtifactSummaryCard.js';
|
| 5 |
import { sampleResources } from '../data/resources.js';
|
| 6 |
import { createResourceCard, initializeResourceCards } from '../cards/ResourceCard.js';
|
|
|
|
| 7 |
|
| 8 |
export function renderAreaPage(areaId) {
|
| 9 |
const area = areasData[areaId];
|
|
@@ -29,17 +30,6 @@ export function renderAreaPage(areaId) {
|
|
| 29 |
}));
|
| 30 |
|
| 31 |
const content = `
|
| 32 |
-
<!-- Page Background Image for Main Content -->
|
| 33 |
-
<div class="fixed opacity-40 z-0" style="top: 104px; left: 256px; right: 0; bottom: 0;" id="area-background-container">
|
| 34 |
-
<img src="images/${area.image}" alt="" class="w-full h-full object-cover pointer-events-none">
|
| 35 |
-
<!-- Attribution Tooltip -->
|
| 36 |
-
<div id="area-bg-attribution" class="absolute bottom-4 right-4 bg-black bg-opacity-75 text-white text-xs px-2 py-1 rounded opacity-0 transition-opacity duration-200 max-w-xs z-50">
|
| 37 |
-
<a href="${area.imageSourceUrl}" target="_blank" class="text-blue-300 hover:text-blue-100">
|
| 38 |
-
${area.imageAttribution}
|
| 39 |
-
</a>
|
| 40 |
-
</div>
|
| 41 |
-
</div>
|
| 42 |
-
|
| 43 |
<!-- Overview Section -->
|
| 44 |
<section id="overview" class="mb-12 relative z-20">
|
| 45 |
<!-- Overview Background Image -->
|
|
@@ -152,14 +142,12 @@ export function renderAreaPage(areaId) {
|
|
| 152 |
// to ensure DOM elements are fully rendered
|
| 153 |
setTimeout(async () => {
|
| 154 |
try {
|
| 155 |
-
console.log('
|
| 156 |
-
//
|
| 157 |
-
const
|
| 158 |
-
if (
|
| 159 |
-
|
| 160 |
}
|
| 161 |
-
const allArtifacts = await response.json();
|
| 162 |
-
console.log('Artifacts loaded:', allArtifacts.length, 'items');
|
| 163 |
|
| 164 |
subAreas.forEach(subArea => {
|
| 165 |
try {
|
|
@@ -187,7 +175,7 @@ export function renderAreaPage(areaId) {
|
|
| 187 |
}
|
| 188 |
});
|
| 189 |
} catch (error) {
|
| 190 |
-
console.error('Error
|
| 191 |
// Fallback to featured artifacts for all carousels
|
| 192 |
subAreas.forEach(subArea => {
|
| 193 |
const carouselId = `${subArea.id}-artifacts-carousel`;
|
|
@@ -221,22 +209,32 @@ export function getAreaPageSidebar(areaId) {
|
|
| 221 |
name: typeof value === 'string' ? value : value.name
|
| 222 |
}));
|
| 223 |
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
}
|
| 241 |
|
| 242 |
function initializeAreaResourceCarousel(resources) {
|
|
|
|
| 4 |
import { createArtifactCarousel } from '../cards/ArtifactSummaryCard.js';
|
| 5 |
import { sampleResources } from '../data/resources.js';
|
| 6 |
import { createResourceCard, initializeResourceCards } from '../cards/ResourceCard.js';
|
| 7 |
+
import { renderSidebar } from '../utils/sidebar.js'; // Import the new sidebar component
|
| 8 |
|
| 9 |
export function renderAreaPage(areaId) {
|
| 10 |
const area = areasData[areaId];
|
|
|
|
| 30 |
}));
|
| 31 |
|
| 32 |
const content = `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
<!-- Overview Section -->
|
| 34 |
<section id="overview" class="mb-12 relative z-20">
|
| 35 |
<!-- Overview Background Image -->
|
|
|
|
| 142 |
// to ensure DOM elements are fully rendered
|
| 143 |
setTimeout(async () => {
|
| 144 |
try {
|
| 145 |
+
console.log('Accessing artifacts from global scope...');
|
| 146 |
+
// Access artifacts from global scope
|
| 147 |
+
const allArtifacts = window.allArtifacts || [];
|
| 148 |
+
if (allArtifacts.length === 0) {
|
| 149 |
+
console.warn('Global artifacts data not available or empty. Falling back to featuredArtifacts.');
|
| 150 |
}
|
|
|
|
|
|
|
| 151 |
|
| 152 |
subAreas.forEach(subArea => {
|
| 153 |
try {
|
|
|
|
| 175 |
}
|
| 176 |
});
|
| 177 |
} catch (error) {
|
| 178 |
+
console.error('Error accessing global artifacts data:', error);
|
| 179 |
// Fallback to featured artifacts for all carousels
|
| 180 |
subAreas.forEach(subArea => {
|
| 181 |
const carouselId = `${subArea.id}-artifacts-carousel`;
|
|
|
|
| 209 |
name: typeof value === 'string' ? value : value.name
|
| 210 |
}));
|
| 211 |
|
| 212 |
+
const sidebarItems = [
|
| 213 |
+
{
|
| 214 |
+
label: 'Overview',
|
| 215 |
+
href: '#overview',
|
| 216 |
+
isNested: false,
|
| 217 |
+
isActive: window.location.hash === '#overview',
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
label: 'Topics',
|
| 221 |
+
isHeader: true,
|
| 222 |
+
isNested: true,
|
| 223 |
+
subItems: subAreas.map(subArea => ({
|
| 224 |
+
label: subArea.name,
|
| 225 |
+
href: `#${subArea.id}`,
|
| 226 |
+
isActive: window.location.hash === `#${subArea.id}`,
|
| 227 |
+
})),
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
label: 'Resources',
|
| 231 |
+
href: '#resources',
|
| 232 |
+
isNested: false,
|
| 233 |
+
isActive: window.location.hash === '#resources',
|
| 234 |
+
},
|
| 235 |
+
];
|
| 236 |
+
|
| 237 |
+
return renderSidebar('On This Page', sidebarItems);
|
| 238 |
}
|
| 239 |
|
| 240 |
function initializeAreaResourceCarousel(resources) {
|
js/pages/HomePage.js
CHANGED
|
@@ -5,20 +5,10 @@ import { createArtifactCarousel } from '../cards/ArtifactSummaryCard.js';
|
|
| 5 |
import { areasData, homeBackgroundImage } from '../data/areas.js';
|
| 6 |
import { featuredArtifacts } from '../data/artifacts.js';
|
| 7 |
import { teamMembers } from '../data/team.js';
|
|
|
|
| 8 |
|
| 9 |
export function renderHomePage() {
|
| 10 |
const content = `
|
| 11 |
-
<!-- Page Background Image for Main Content -->
|
| 12 |
-
<div class="fixed opacity-40 z-0" style="top: 104px; left: 256px; right: 0; bottom: 0;" id="home-background-container">
|
| 13 |
-
<img src="images/${homeBackgroundImage.image}" alt="" class="w-full h-full object-cover pointer-events-none">
|
| 14 |
-
<!-- Attribution Tooltip -->
|
| 15 |
-
<div id="home-bg-attribution" class="absolute bottom-4 right-4 bg-black bg-opacity-75 text-white text-xs px-2 py-1 rounded opacity-0 transition-opacity duration-200 max-w-xs z-50">
|
| 16 |
-
<a href="${homeBackgroundImage.sourceUrl}" target="_blank" class="text-blue-300 hover:text-blue-100">
|
| 17 |
-
${homeBackgroundImage.attribution}
|
| 18 |
-
</a>
|
| 19 |
-
</div>
|
| 20 |
-
</div>
|
| 21 |
-
|
| 22 |
<!-- Team Introduction Section -->
|
| 23 |
<section id="intro" class="mb-12 relative z-20">
|
| 24 |
<!-- Part 1: Team Introduction and Research Areas -->
|
|
@@ -107,29 +97,56 @@ export function renderHomePage() {
|
|
| 107 |
}
|
| 108 |
|
| 109 |
export function getHomePageSidebar() {
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
}
|
| 134 |
|
| 135 |
function initializeTeamMembers() {
|
|
@@ -159,7 +176,7 @@ function initializeHomeAreaCards() {
|
|
| 159 |
|
| 160 |
const areas = Object.values(areasData);
|
| 161 |
areasContainer.innerHTML = areas.map(area =>
|
| 162 |
-
createHomeAreaCard(area.id, area.title, area.description, area.openness, Object.values(area.subAreas).map(sub => typeof sub === 'string' ? sub : sub.name), area.imagePosition, area.imageAttribution, area.imageAltText)
|
| 163 |
).join('');
|
| 164 |
}
|
| 165 |
|
|
|
|
| 5 |
import { areasData, homeBackgroundImage } from '../data/areas.js';
|
| 6 |
import { featuredArtifacts } from '../data/artifacts.js';
|
| 7 |
import { teamMembers } from '../data/team.js';
|
| 8 |
+
import { renderSidebar } from '../utils/sidebar.js'; // Import the new sidebar component
|
| 9 |
|
| 10 |
export function renderHomePage() {
|
| 11 |
const content = `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
<!-- Team Introduction Section -->
|
| 13 |
<section id="intro" class="mb-12 relative z-20">
|
| 14 |
<!-- Part 1: Team Introduction and Research Areas -->
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
export function getHomePageSidebar() {
|
| 100 |
+
const sidebarItems = [
|
| 101 |
+
{
|
| 102 |
+
label: 'Team Introduction',
|
| 103 |
+
href: '#intro',
|
| 104 |
+
isNested: false,
|
| 105 |
+
isActive: window.location.hash === '#intro',
|
| 106 |
+
subItems: [
|
| 107 |
+
{
|
| 108 |
+
label: 'Recent & Featured Works',
|
| 109 |
+
href: '#recent-featured-works',
|
| 110 |
+
isActive: window.location.hash === '#recent-featured-works',
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
label: 'Team Members',
|
| 114 |
+
href: '#team-members',
|
| 115 |
+
isActive: window.location.hash === '#team-members',
|
| 116 |
+
},
|
| 117 |
+
],
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
label: 'Research Areas',
|
| 121 |
+
href: '#research-areas-header',
|
| 122 |
+
isNested: false,
|
| 123 |
+
isActive: window.location.hash === '#research-areas-header',
|
| 124 |
+
subItems: [
|
| 125 |
+
{
|
| 126 |
+
label: 'Efficiency & Environment',
|
| 127 |
+
href: '#efficiency',
|
| 128 |
+
isActive: window.location.hash === '#efficiency',
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
label: 'Consent & Personal Interactions',
|
| 132 |
+
href: '#personal',
|
| 133 |
+
isActive: window.location.hash === '#personal',
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
label: 'Rights & Regulation',
|
| 137 |
+
href: '#rights',
|
| 138 |
+
isActive: window.location.hash === '#rights',
|
| 139 |
+
},
|
| 140 |
+
{
|
| 141 |
+
label: 'Socio-Economic & Technical Ecosystems',
|
| 142 |
+
href: '#ecosystems',
|
| 143 |
+
isActive: window.location.hash === '#ecosystems',
|
| 144 |
+
},
|
| 145 |
+
],
|
| 146 |
+
},
|
| 147 |
+
];
|
| 148 |
+
|
| 149 |
+
return renderSidebar('On This Page', sidebarItems);
|
| 150 |
}
|
| 151 |
|
| 152 |
function initializeTeamMembers() {
|
|
|
|
| 176 |
|
| 177 |
const areas = Object.values(areasData);
|
| 178 |
areasContainer.innerHTML = areas.map(area =>
|
| 179 |
+
createHomeAreaCard(area.id, area.title, area.description, area.openness, Object.values(area.subAreas).map(sub => typeof sub === 'string' ? sub : sub.name), area.image, area.imagePosition, area.imageAttribution, area.imageAltText)
|
| 180 |
).join('');
|
| 181 |
}
|
| 182 |
|
js/pages/ResourcesPage.js
CHANGED
|
@@ -3,20 +3,10 @@ import { homeBackgroundImage, areasData } from '../data/areas.js';
|
|
| 3 |
import { pressMentions } from '../data/press.js';
|
| 4 |
import { sampleResources } from '../data/resources.js';
|
| 5 |
import { createResourceCard, initializeResourceCards } from '../cards/ResourceCard.js';
|
|
|
|
| 6 |
|
| 7 |
export function renderResourcesPage() {
|
| 8 |
const content = `
|
| 9 |
-
<!-- Page Background Image for Main Content -->
|
| 10 |
-
<div class="fixed opacity-40 z-0" style="top: 104px; left: 256px; right: 0; bottom: 0;" id="resources-background-container">
|
| 11 |
-
<img src="images/${homeBackgroundImage.image}" alt="" class="w-full h-full object-cover pointer-events-none">
|
| 12 |
-
<!-- Attribution Tooltip -->
|
| 13 |
-
<div id="resources-bg-attribution" class="absolute bottom-4 right-4 bg-black bg-opacity-75 text-white text-xs px-2 py-1 rounded opacity-0 transition-opacity duration-200 max-w-xs z-50">
|
| 14 |
-
<a href="${homeBackgroundImage.sourceUrl}" target="_blank" class="text-blue-300 hover:text-blue-100">
|
| 15 |
-
${homeBackgroundImage.attribution}
|
| 16 |
-
</a>
|
| 17 |
-
</div>
|
| 18 |
-
</div>
|
| 19 |
-
|
| 20 |
<!-- Technical Resources Section -->
|
| 21 |
<section id="technical-resources" class="mb-12 relative z-20">
|
| 22 |
<div class="bg-white bg-opacity-90 backdrop-blur-sm rounded-lg shadow-sm p-8">
|
|
@@ -167,15 +157,22 @@ export function renderResourcesPage() {
|
|
| 167 |
}
|
| 168 |
|
| 169 |
export function getResourcesPageSidebar() {
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
}
|
| 180 |
|
| 181 |
function initializeResourcesBackgroundAttribution() {
|
|
|
|
| 3 |
import { pressMentions } from '../data/press.js';
|
| 4 |
import { sampleResources } from '../data/resources.js';
|
| 5 |
import { createResourceCard, initializeResourceCards } from '../cards/ResourceCard.js';
|
| 6 |
+
import { renderSidebar } from '../utils/sidebar.js'; // Import the new sidebar component
|
| 7 |
|
| 8 |
export function renderResourcesPage() {
|
| 9 |
const content = `
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
<!-- Technical Resources Section -->
|
| 11 |
<section id="technical-resources" class="mb-12 relative z-20">
|
| 12 |
<div class="bg-white bg-opacity-90 backdrop-blur-sm rounded-lg shadow-sm p-8">
|
|
|
|
| 157 |
}
|
| 158 |
|
| 159 |
export function getResourcesPageSidebar() {
|
| 160 |
+
const sidebarItems = [
|
| 161 |
+
{
|
| 162 |
+
label: 'Technical Resources',
|
| 163 |
+
href: '#technical-resources',
|
| 164 |
+
isNested: false,
|
| 165 |
+
isActive: window.location.hash === '#technical-resources',
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
label: 'Press Mentions',
|
| 169 |
+
href: '#press-mentions',
|
| 170 |
+
isNested: false,
|
| 171 |
+
isActive: window.location.hash === '#press-mentions',
|
| 172 |
+
},
|
| 173 |
+
];
|
| 174 |
+
|
| 175 |
+
return renderSidebar('Resources', sidebarItems);
|
| 176 |
}
|
| 177 |
|
| 178 |
function initializeResourcesBackgroundAttribution() {
|