diff --git a/eslint.config.cjs b/eslint.config.cjs index 5a1c52e39..42748c817 100644 --- a/eslint.config.cjs +++ b/eslint.config.cjs @@ -223,4 +223,37 @@ module.exports = [ "no-console": "off", }, }, + // Website browser scripts — run in the browser, not Node.js + { + files: ["website/src/scripts/**/*.js"], + languageOptions: { + parserOptions: { + ecmaVersion: 2024, + sourceType: "module", + }, + globals: { + // Browser globals + document: "readonly", + window: "readonly", + navigator: "readonly", + localStorage: "readonly", + sessionStorage: "readonly", + CustomEvent: "readonly", + Event: "readonly", + IntersectionObserver: "readonly", + MutationObserver: "readonly", + requestAnimationFrame: "readonly", + clearTimeout: "readonly", + setTimeout: "readonly", + console: "readonly", + }, + }, + plugins: { prettier }, + rules: { + "prettier/prettier": "warn", + "no-unused-vars": ["warn", { argsIgnorePattern: "^_" }], + "no-console": "off", + "no-empty": ["error", { allowEmptyCatch: true }], + }, + }, ]; diff --git a/website/src/components/Header.astro b/website/src/components/Header.astro new file mode 100644 index 000000000..6f04c793c --- /dev/null +++ b/website/src/components/Header.astro @@ -0,0 +1,675 @@ +--- +import { CATEGORIES } from '../lib/catalogue'; + +const base = import.meta.env.BASE_URL; +const pathname = Astro.url.pathname; + +const isActive = (path: string): boolean => { + const baseClean = base.replace(/\/$/, ''); + const rawNorm = pathname.replace(/\/$/, ''); + const norm = baseClean && rawNorm.startsWith(baseClean) ? rawNorm.slice(baseClean.length) : rawNorm; + const p = path.replace(/\/$/, ''); + return norm === p || norm.startsWith(p + '/'); +}; + +/* Icon path data (Heroicons-style, 24×24, 1.6 stroke) */ +const icons = { + chevronDown: ``, + search: ``, + robot: ``, + book: ``, + chat: ``, + sparkles: ``, + shield: ``, + workflow: ``, + puzzle: ``, + wrench: ``, + bolt: ``, + download: ``, + layers: ``, + github: ``, + external: ``, + menu: ``, + close: ``, +}; + +const catIconMap: Record = { + agents: icons.robot, instructions: icons.book, prompts: icons.chat, + skills: icons.sparkles, hooks: icons.shield, workflows: icons.workflow, + plugins: icons.puzzle, tools: icons.wrench, +}; + +function svg(paths: string, size = 20) { + return `${paths}`; +} + +const resources = [ + { href: `${base}onboarding/`, icon: icons.bolt, label: 'Onboarding journey' }, + { href: `${base}getting-started/`, icon: icons.download, label: 'Getting started' }, + { href: `${base}why/`, icon: icons.layers, label: 'Why this exists' }, + { href: `${base}glossary/`, icon: icons.book, label: 'Glossary' }, + { href: `${base}references/`, icon: icons.github, label: 'References' }, +]; +--- + + + + + + + + + + Awesome GitHub + + + + + + + + + Browse + + + + {CATEGORIES.map(cat => ( + + + + {cat.label} + {cat.blurb} + + + ))} + + + + Cookbook + Learn + + + + + Resources + + + + {resources.map(r => ( + + + {r.label} + + ))} + + + + + + + + + Search resources + ⌘K + + + + + + + main + + + dev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/website/src/layouts/AwesomeGithubLayout.astro b/website/src/layouts/AwesomeGithubLayout.astro index 1e079fed6..998091cb6 100644 --- a/website/src/layouts/AwesomeGithubLayout.astro +++ b/website/src/layouts/AwesomeGithubLayout.astro @@ -1,21 +1,10 @@ --- import "../styles/global.css"; import "../styles/awesome-github.css"; -import AwesomeGithubNav from "../components/AwesomeGithub/AwesomeGithubNav.astro"; +import Header from "../components/Header.astro"; import AwesomeGithubFooter from "../components/AwesomeGithub/AwesomeGithubFooter.astro"; -import { ITEMS } from "../lib/catalogue"; const base = import.meta.env.BASE_URL; -const pathname = Astro.url.pathname.replace(base, "/"); - -const searchItems = ITEMS.map((i) => ({ - id: i.id, - slug: i.slug, - cat: i.cat, - name: i.name, - description: i.description, - tags: i.tags, -})); const { title = "Awesome GitHub", @@ -38,33 +27,11 @@ const themeInitScript = `(function(){try{var s='ag-theme',t=localStorage.getItem Skip to main content - + -