Skip to content

Commit

Permalink
Merge pull request #926 from SnowCait/developer-mode
Browse files Browse the repository at this point in the history
Developer mode
  • Loading branch information
SnowCait authored Dec 18, 2023
2 parents 93f0483 + 59db39d commit d6fa987
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 71 deletions.
9 changes: 9 additions & 0 deletions web/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ progress {
[aria-disabled='true'] {
cursor: default;
}

/* End reset css */

:root {
Expand Down Expand Up @@ -494,3 +495,11 @@ dialog::backdrop {
svg.logo {
fill: var(--accent);
}

code {
display: block;
white-space: pre;
background-color: var(--accent-surface-low);
overflow: auto;
padding: 0.8rem;
}
3 changes: 2 additions & 1 deletion web/src/lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"or": "OR",
"preferences": {
"uri_scheme": "Open web+nostr: in nostter",
"enable_uri_scheme": "Enable"
"enable_uri_scheme": "Enable",
"developer_mode": "Developer mode"
},
"content": {
"show": "Show"
Expand Down
3 changes: 2 additions & 1 deletion web/src/lib/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"or": "または",
"preferences": {
"uri_scheme": "web+nostr: を nostter で開く",
"enable_uri_scheme": "有効化"
"enable_uri_scheme": "有効化",
"developer_mode": "開発者モード"
},
"content": {
"show": "表示"
Expand Down
12 changes: 1 addition & 11 deletions web/src/routes/(app)/content/LongFormContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<h5>ID</h5>
<div>{naddr}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(event, null, 2)}</code></pre>
<code>{JSON.stringify(event, null, 2)}</code>
<div>
Open in <a
href="https://koteitan.github.io/nostr-post-checker/?eid={nip19.neventEncode({
Expand Down Expand Up @@ -111,14 +111,4 @@
color: lightgray;
height: 20px;
}
.develop pre {
background-color: #f6f8fa;
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
</style>
8 changes: 7 additions & 1 deletion web/src/routes/(app)/preferences/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ReactionEmoji from './ReactionEmoji.svelte';
import Logout from '../Logout.svelte';
import { author } from '../../../stores/Author';
import { debugMode } from '../../../stores/Preference';
import { debugMode, developerMode } from '../../../stores/Preference';
import WordMute from './WordMute.svelte';
import AutoRefresh from './AutoRefresh.svelte';
import MutedUsers from './MutedUsers.svelte';
Expand All @@ -15,6 +15,8 @@
import ZapButton from '$lib/components/ZapButton.svelte';
import UriScheme from './UriScheme.svelte';
import EnablePreview from './EnablePreview.svelte';
import DeveloperMode from './DeveloperMode.svelte';
import WebStorage from './WebStorage.svelte';
let debugCounter = 0;
Expand All @@ -40,6 +42,10 @@
<div><Notification /></div>
<div><UriScheme /></div>
<div><AutoRefresh /></div>
<div><DeveloperMode /></div>
{#if $developerMode}
<div><WebStorage /></div>
{/if}
{#if $debugMode}
<div><ClearEmojiMartCache /></div>
{/if}
Expand Down
9 changes: 9 additions & 0 deletions web/src/routes/(app)/preferences/DeveloperMode.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts">
import { _ } from 'svelte-i18n';
import { developerMode } from '../../../stores/Preference';
</script>

<label>
<input type="checkbox" bind:value={$developerMode} />
<span>{$_('preferences.developer_mode')}</span>
</label>
19 changes: 19 additions & 0 deletions web/src/routes/(app)/preferences/WebStorage.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<section class="card">
<h3>Local storage</h3>
<code>{JSON.stringify(localStorage, null, 2)}</code>
</section>

<section class="card">
<h3>Session storage</h3>
<code>{JSON.stringify(sessionStorage, null, 2)}</code>
</section>

<style>
section + section {
margin-top: 1rem;
}
h3 {
margin: 0.5rem auto;
}
</style>
12 changes: 1 addition & 11 deletions web/src/routes/(app)/timeline/Channel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<h5>ID</h5>
<div>{nip19.neventEncode({ id: event.id })}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(event, null, 2)}</code></pre>
<code>{JSON.stringify(event, null, 2)}</code>
<div>
Open in <a
href="https://koteitan.github.io/nostr-post-checker/?eid={nip19.neventEncode({
Expand Down Expand Up @@ -142,14 +142,4 @@
color: lightgray;
height: 20px;
}
.develop pre {
background-color: #f6f8fa;
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
</style>
14 changes: 2 additions & 12 deletions web/src/routes/(app)/timeline/Note.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,11 @@
<br />
<div>{nip19.neventEncode({ id: item.event.id })}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(item.event, null, 2)}</code></pre>
<code>{JSON.stringify(item.event, null, 2)}</code>
<h5>User ID</h5>
<div>{nip19.npubEncode(item.event.pubkey)}</div>
<h5>User JSON</h5>
<pre><code class="json">{JSON.stringify(metadata?.content, null, 2)}</code
></pre>
<code>{JSON.stringify(metadata?.content, null, 2)}</code>
<h5>Code Points</h5>
<h6>display name</h6>
<p>
Expand Down Expand Up @@ -495,15 +494,6 @@
background-color: var(--surface);
}
.develop pre {
background-color: var(--accent-surface-low);
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
.channel,
.proxy {
margin-top: 0.4rem;
Expand Down
13 changes: 2 additions & 11 deletions web/src/routes/(app)/timeline/Reaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
<br />
<div>{nip19.neventEncode({ id: event.id })}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(event, null, 2)}</code></pre>
<code>{JSON.stringify(event, null, 2)}</code>
<h5>User ID</h5>
<div>{nip19.npubEncode(event.pubkey)}</div>
<h5>User JSON</h5>
<pre><code class="json">{JSON.stringify(metadata?.content, null, 2)}</code></pre>
<code>{JSON.stringify(metadata?.content, null, 2)}</code>
<div>
Open in <a
href="https://koteitan.github.io/nostr-post-checker/?eid={nip19.neventEncode({
Expand Down Expand Up @@ -115,13 +115,4 @@
color: lightgray;
height: 20px;
}
.develop pre {
background-color: #f6f8fa;
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
</style>
13 changes: 2 additions & 11 deletions web/src/routes/(app)/timeline/RepostedNote.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@
<br />
<div>{nip19.neventEncode({ id: item.event.id })}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(item.event, null, 2)}</code></pre>
<code>{JSON.stringify(item.event, null, 2)}</code>
<h5>User ID</h5>
<div>{nip19.npubEncode(item.event.pubkey)}</div>
<h5>User JSON</h5>
<pre><code class="json">{JSON.stringify(metadata?.content, null, 2)}</code></pre>
<code>{JSON.stringify(metadata?.content, null, 2)}</code>
<div>
Open in <a
href="https://koteitan.github.io/nostr-post-checker/?eid={nip19.neventEncode({
Expand Down Expand Up @@ -114,13 +114,4 @@
color: var(--accent-gray);
height: 20px;
}
.develop pre {
background-color: #f6f8fa;
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
</style>
15 changes: 3 additions & 12 deletions web/src/routes/(app)/timeline/Zap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@
<br />
<div>{nip19.neventEncode({ id: event.id })}</div>
<h5>Event JSON</h5>
<pre><code class="json">{JSON.stringify(event, null, 2)}</code></pre>
<code>{JSON.stringify(event, null, 2)}</code>
<h5>Zap Request Event JSON</h5>
<pre><code class="json">{JSON.stringify(zapRequestEvent, null, 2)}</code></pre>
<code>{JSON.stringify(zapRequestEvent, null, 2)}</code>
<h5>User ID</h5>
<div>{nip19.npubEncode(event.pubkey)}</div>
<h5>User JSON</h5>
<pre><code class="json">{JSON.stringify(metadata?.content, null, 2)}</code></pre>
<code>{JSON.stringify(metadata?.content, null, 2)}</code>
<div>
Open in <a
href="https://koteitan.github.io/nostr-post-checker/?eid={nip19.neventEncode({
Expand Down Expand Up @@ -142,13 +142,4 @@
color: var(--accent-gray);
height: 20px;
}
.develop pre {
background-color: #f6f8fa;
padding: 0.5em;
overflow: auto;
}
.develop .json {
font-size: 0.8em;
}
</style>
3 changes: 3 additions & 0 deletions web/src/stores/Preference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ if (browser) {
storage.set('preference:auto-refresh', JSON.stringify(value));
});
}

export const enablePreview = writable(
browser ? new WebStorage(localStorage).get('preference:preview') !== 'false' : true
);

export const developerMode = writable(false);

// Temporary
export const debugMode = writable(false);

1 comment on commit d6fa987

@vercel
Copy link

@vercel vercel bot commented on d6fa987 Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nostter – ./

nostter-snowcait.vercel.app
nostter-git-main-snowcait.vercel.app
nostter.vercel.app
nostter.app

Please sign in to comment.