repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

commit
4eed2cc
parent
dd84033
author
Eric Bower
date
2022-11-27 19:33:00 +0000 UTC
flourish
3 files changed,  +42, -37
M src/scripts/static.ts
+37, -37
  1@@ -77,7 +77,7 @@ const createNav = () => {
  2 <div class="nav">
  3   <h1 id="logo">
  4     <a href="/" class="logo-header">neovimcraft</a>
  5-    <a href="https://github.com/neurosnap/neovimcraft" class="gh">
  6+    <a href="https://github.com/neurosnap/neovimcraft" class="flex">
  7       ${createIcon("github")}
  8     </a>
  9   </h1>
 10@@ -130,6 +130,17 @@ const createPluginItem = (plugin: Plugin, tags: Tag[]) => {
 11     .map((t) => t.id)
 12     .join(",")
 13     .toLocaleLowerCase();
 14+  const nf = new Intl.NumberFormat('en-US');
 15+
 16+  let repoLink = `
 17+    <a href=${plugin.link} class="flex">${createIcon("github")}</a>
 18+    <div class="metric-item">${createIcon("star")} <span>${nf.format(plugin.stars)}</span></div>
 19+    <div class="metric-item">
 20+      ${createIcon("alert-circle")} <span>${nf.format(plugin.openIssues)}</span>
 21+    </div>`;
 22+  if (plugin.type === 'srht') {
 23+    repoLink = `<a href=${plugin.link} class="flex">${createIcon("srht")}</a>`
 24+  }
 25 
 26   return `
 27 <div class="container plugin" data-repo="${dataRepo}" data-desc="${dataDesc}" data-tags="${dataTags}">
 28@@ -138,19 +149,7 @@ const createPluginItem = (plugin: Plugin, tags: Tag[]) => {
 29       <a href="/plugin/${plugin.username}/${plugin.repo}">${plugin.repo}</a>
 30     </h2>
 31     <div class="metrics">
 32-      <Tooltip tip="github repo" bottom>
 33-        <a href=${plugin.link}>${createIcon("github")}</a>
 34-      </Tooltip>
 35-      <Tooltip tip="stars" bottom>
 36-        <div class="metric-item">${
 37-    createIcon("star")
 38-  } <span>${plugin.stars}</span></div>
 39-      </Tooltip>
 40-      <Tooltip tip="open issues" bottom>
 41-        <div class="metric-item">
 42-          ${createIcon("alert-circle")} <span>${plugin.openIssues}</span>
 43-        </div>
 44-      </Tooltip>
 45+      ${repoLink}
 46     </div>
 47   </div>
 48   <div class="date">
 49@@ -319,34 +318,35 @@ const createPluginView = (plugin: Plugin, tags: Tag[]) => {
 50     acc += createTag(tag, false);
 51     return acc;
 52   }, "");
 53+  const nf = new Intl.NumberFormat('en-US');
 54+
 55+  let metricsStr = '';
 56+  if (plugin.type === 'github') {
 57+    metricsStr = `
 58+    <div class="metrics_view">
 59+        <div class="metric">
 60+          ${createIcon("star")}
 61+          <span>${nf.format(plugin.stars)}</span>
 62+        </div>
 63+        <div class="metric">
 64+          ${createIcon("alert-circle")}
 65+          <span>${nf.format(plugin.openIssues)}</span>
 66+        </div>
 67+        <div class="metric">
 68+          ${createIcon("users")} <span>${nf.format(plugin.subscribers)}</span>
 69+        </div>
 70+        <div class="metric">
 71+          ${createIcon("git-branch")} <span>${nf.format(plugin.forks)}</span>
 72+        </div>
 73+    </div>`;
 74+  }
 75 
 76   return `
 77 <div class="meta">
 78   <div class="tags_view">
 79     ${tagsStr}
 80   </div>
 81-  <div class="metrics_view">
 82-    <Tooltip tip="stars" bottom>
 83-      <div class="metric">${
 84-    createIcon("star")
 85-  } <span>${plugin.stars}</span></div>
 86-    </Tooltip>
 87-    <Tooltip tip="open issues" bottom>
 88-      <div class="metric">${
 89-    createIcon("alert-circle")
 90-  } <span>${plugin.openIssues}</span></div>
 91-    </Tooltip>
 92-    <Tooltip tip="subscribers" bottom>
 93-      <div class="metric">${
 94-    createIcon("users")
 95-  } <span>${plugin.subscribers}</span></div>
 96-    </Tooltip>
 97-    <Tooltip tip="forks" bottom>
 98-      <div class="metric">${
 99-    createIcon("git-branch")
100-  } <span>${plugin.forks}</span></div>
101-    </Tooltip>
102-  </div>
103+  ${metricsStr}
104   <div class="timestamps">
105     <div>
106       <h5 class="ts_header">CREATED</h5>
107@@ -382,7 +382,7 @@ const createPluginPage = (plugin: Plugin, tags: Tag[], html: string) => {
108     <div class="header">
109       <h1>${plugin.id}</h1>
110       ${plugin.homepage ? `<a href=${plugin.homepage}>website</a>` : ""}
111-      <a href=${plugin.link}>${createIcon("github")} <span>github</span></a>
112+      <a href=${plugin.link} class="flex">${createIcon("github")} <span>github</span></a>
113     </div>
114     ${createPluginView(plugin, tags)}
115     ${html}
M static/main.css
+4, -0
 1@@ -38,6 +38,10 @@
 2   background-color: var(--highlight-secondary);
 3 }
 4 
 5+.flex {
 6+  display: flex;
 7+}
 8+
 9 html {
10   overflow-x: hidden;
11 }
A static/srht.svg
+1, -0
1@@ -0,0 +1 @@
2+<svg height="24" viewBox="0 0 512 512" width="24" xmlns="http://www.w3.org/2000/svg" fill="#f2f2f2"><path d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"></path></svg>