Yacine Jernite commited on
Commit
aedd3f1
1 Parent(s): b1f7a7d

initialize gallery

Browse files
Files changed (2) hide show
  1. index.html +1 -0
  2. scripts/main.js +19 -2
index.html CHANGED
@@ -57,6 +57,7 @@
57
  <div id="vignettes">
58
  <div id="itemSidebar">
59
  <h3>Filter by Tags</h3>
 
60
  <ul id="tagList">
61
  <!-- Tags will be dynamically added here -->
62
  </ul>
 
57
  <div id="vignettes">
58
  <div id="itemSidebar">
59
  <h3>Filter by Tags</h3>
60
+ <p>Select a tag below to see all resources related to it:</p>
61
  <ul id="tagList">
62
  <!-- Tags will be dynamically added here -->
63
  </ul>
scripts/main.js CHANGED
@@ -28,6 +28,13 @@ const items = [
28
  link: 'topics.html#Systems',
29
  description: 'This topic card on the Impact of AI on Social Systems provides descriptions and resources.'
30
  },
 
 
 
 
 
 
 
31
  ];
32
 
33
  // Populate the tag list in the sidebar
@@ -44,6 +51,7 @@ uniqueTags.forEach(tag => {
44
 
45
  // Function to display items based on selected tag
46
  function displayItemsByTag(selectedTag) {
 
47
  const itemContainer = document.getElementById('itemGallery');
48
  itemContainer.innerHTML = '';
49
 
@@ -73,5 +81,14 @@ function displayItemsByTag(selectedTag) {
73
  }
74
 
75
  const showing = document.getElementById('sidebarShowing');
76
- showing.textContent = `Showing projects relevant to: ${selectedTag}`
77
- }
 
 
 
 
 
 
 
 
 
 
28
  link: 'topics.html#Systems',
29
  description: 'This topic card on the Impact of AI on Social Systems provides descriptions and resources.'
30
  },
31
+ {
32
+ title: '🤗 Policy Writings',
33
+ tags: ['regulation', 'openness', 'privacy', 'society'],
34
+ image: 'images/hf-logo.png',
35
+ link: 'projects.html#Policy',
36
+ description: 'Policy-relevant writings, including comments on regulation, responses from RFIs, etc.'
37
+ },
38
  ];
39
 
40
  // Populate the tag list in the sidebar
 
51
 
52
  // Function to display items based on selected tag
53
  function displayItemsByTag(selectedTag) {
54
+ localStorage.setItem("gallery-tag", selectedTag)
55
  const itemContainer = document.getElementById('itemGallery');
56
  itemContainer.innerHTML = '';
57
 
 
81
  }
82
 
83
  const showing = document.getElementById('sidebarShowing');
84
+ showing.innerHTML = `Showing projects relevant to: <strong>${selectedTag}</strong>`
85
+ }
86
+
87
+ // Start with society
88
+ if (!localStorage.getItem("gallery-tag")) {
89
+ displayItemsByTag("society");
90
+ } else {
91
+ const selectedTag = localStorage.getItem("gallery-tag");
92
+ displayItemsByTag(selectedTag);
93
+ }
94
+