Repository navigation
feat(store): shareable catalog/extension deep links + correct Discord invite #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,7 +109,7 @@ | |
| class="hidden h-9 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium text-zinc-400 transition hover:bg-zinc-900 hover:text-zinc-100 sm:flex"> | ||
| <i data-lucide="github" class="h-4 w-4"></i> GitHub | ||
| </a> | ||
| <a href="https://discord.gg/openrom" target="_blank" rel="noopener" | ||
| <a href="https://discord.gg/FYEjpcFYXc" target="_blank" rel="noopener" | ||
| class="hidden h-9 items-center gap-1.5 rounded-lg px-2.5 text-sm font-medium text-zinc-400 transition hover:bg-zinc-900 hover:text-zinc-100 md:flex"> | ||
| <i data-lucide="message-circle" class="h-4 w-4"></i> Discord | ||
| </a> | ||
|
|
@@ -351,7 +351,7 @@ <h2 class="text-xl font-bold text-white">Ship your own OpenROM extension</h2> | |
| <p>© <span x-text="new Date().getFullYear()"></span> OpenROM Project — retro-gaming preservation. Not affiliated with Nintendo, Sony, Sega or Microsoft.</p> | ||
| <div class="flex items-center gap-4"> | ||
| <a href="https://github.com/M5Devs/OpenROM-Plugins-Store" target="_blank" rel="noopener" class="transition hover:text-zinc-300">Repository</a> | ||
| <a href="https://discord.gg/openrom" target="_blank" rel="noopener" class="transition hover:text-zinc-300">Discord</a> | ||
| <a href="https://discord.gg/FYEjpcFYXc" target="_blank" rel="noopener" class="transition hover:text-zinc-300">Discord</a> | ||
| <span class="flex items-center gap-1"><i data-lucide="cloud" class="h-3 w-3"></i> Cloudflare Pages</span> | ||
| </div> | ||
| </div> | ||
|
|
@@ -589,6 +589,8 @@ <h4 class="mb-2 flex items-center gap-2 text-xs font-bold uppercase tracking-wid | |
| } | ||
| this.loading = false; | ||
| this.$nextTick(() => window.lucide && lucide.createIcons()); | ||
| this.applyDeepLink(); | ||
| window.addEventListener('popstate', () => this.applyDeepLink()); | ||
| window.addEventListener('keydown', (ev) => { | ||
| if (ev.key === '/' && document.activeElement.tagName !== 'INPUT') { | ||
| ev.preventDefault(); | ||
|
|
@@ -597,6 +599,18 @@ <h4 class="mb-2 flex items-center gap-2 text-xs font-bold uppercase tracking-wid | |
| }); | ||
| }, | ||
|
|
||
| // Shareable links: ?q=<search> prefilters the catalog, ?ext=<id> opens a drawer. | ||
| applyDeepLink() { | ||
| const params = new URLSearchParams(location.search); | ||
| const q = params.get('q'); | ||
| if (q) this.query = q; | ||
| const ext = params.get('ext'); | ||
| if (ext) { | ||
| const plugin = this.plugins.find((p) => p.id === ext); | ||
| if (plugin) this.openDetail(plugin); | ||
|
Comment on lines
+608
to
+610
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Close the drawer when the history entry has no matching extension. From the catalog, click “Explore the catalog,” open a detail drawer, then press Back. The destination has no Clear
|
||
| } | ||
| }, | ||
|
|
||
| get publishers() { | ||
| const map = new Map(); | ||
| this.plugins.forEach((p) => { | ||
|
|
@@ -656,8 +670,15 @@ <h4 class="mb-2 flex items-center gap-2 text-xs font-bold uppercase tracking-wid | |
| togglePublisher(id) { const i = this.publishers_active.indexOf(id); i === -1 ? this.publishers_active.push(id) : this.publishers_active.splice(i, 1); }, | ||
| resetFilters() { this.query = ''; this.category = 'All'; this.platforms = []; this.publishers_active = []; this.sort = 'relevance'; }, | ||
|
|
||
| openDetail(plugin) { this.detail = plugin; this.tab = 'overview'; this.$nextTick(() => window.lucide && lucide.createIcons()); }, | ||
| closeDetail() { this.detail = null; }, | ||
| openDetail(plugin) { this.detail = plugin; this.tab = 'overview'; this.syncUrl('ext', plugin.id); this.$nextTick(() => window.lucide && lucide.createIcons()); }, | ||
| closeDetail() { this.detail = null; this.syncUrl('ext', null); }, | ||
|
|
||
| // Keep the address bar in sync so drawer links can be shared or bookmarked. | ||
| syncUrl(key, value) { | ||
| const url = new URL(location.href); | ||
| if (value) url.searchParams.set(key, value); else url.searchParams.delete(key); | ||
| history.replaceState(null, '', url); | ||
| }, | ||
|
|
||
| installCmd(p) { return 'openrom-core --install-plugin ' + p.id; }, | ||
| routeFrom(r) { return r.split('->')[0].trim(); }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: M5Devs/OpenROM-Plugins-Store
Length of output: 23632
Script executed:
Repository: M5Devs/OpenROM-Plugins-Store
Length of output: 7799
Keep the
qURL parameter synchronized with search state.The search input changes
query, but it does not update the URL. WhenapplyDeepLink()handles a history destination withoutq, it leaves the previous search unchanged. Opening a drawer then preserves that staleqin the shareable URL.Set
queryto an empty string whenqis absent, and synchronizeqwheneverquerychanges.Suggested fix
async init() { + this.$watch('query', (value) => this.syncUrl('q', value.trim() || null)); try { const res = await fetch('plugins.json', { cache: 'no-cache' }); @@ const params = new URLSearchParams(location.search); const q = params.get('q'); - if (q) this.query = q; + this.query = q || '';