Skip to content
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

Feature/dm mode #55

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Select } from "@thisbeyond/solid-select";
import "@thisbeyond/solid-select/style.css";

const options = [
{ label: 'Tony Cark', name: 'npub1pmzw37x9fznr0a3znjy4t9rspgx8cs8duqw9tf7d72x2rykr6ypqzyxhmy' },
{ label: "Purple Text, Orange Highlights (article by Gigi)", name: "naddr1qqxnzd3cxqmrzv3exgmr2wfeqgsxu35yyt0mwjjh8pcz4zprhxegz69t4wr9t74vk6zne58wzh0waycrqsqqqa28pjfdhz" },
{ label: "Nostr (fiatjaf's blog)", name: "https://fiatjaf.com/nostr.html" },
{ label: "A native internet protocol for social media (article by Jack)", name: "naddr1qqxnzd3cxyerxd3h8qerwwfcqgsgydql3q4ka27d9wnlrmus4tvkrnc8ftc4h8h5fgyln54gl0a7dgsrqsqqqa28387u5u" },
Expand Down Expand Up @@ -41,11 +42,11 @@ function App() {
<a class="github-fork-ribbon" href="https://github.com/fr4nzap/zapthreads" data-ribbon="Code on GitHub" title="Code on GitHub">Code on GitHub</a>
<h1 style={"display: flex; justify-content: center;"}>zap<svg xmlns="http://www.w3.org/2000/svg" viewBox="-75 0 600 600"><path d="M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z" /></svg>threads</h1>

{/* <p>
<p>
{npub() && <span>Logged in as {npub()}</span>}
</p>
<button onClick={() => npub() ? setNpub('') : setNpub(defaultNpub)}>{npub() ? 'Log out' : 'Log in'}</button>
<hr /> */}
<hr />

<h3>Select a resource: &nbsp;
<Select class="custom" initialValue={options[0]} options={options} format={(item) => item.label} onChange={(e) => setAnchor(e.name)} />
Expand All @@ -69,7 +70,7 @@ function App() {
<h3>Relays: <input type='text' value={relays()} onChange={(e) => setRelays(e.target.value)}></input></h3>

<div style="min-height: 1000px; min-width: 700px; margin-top: -2rem">
{anchor() && <zap-threads reply-placeholder='Write something...' anchor={anchor()} disable={disabled().join(',')} relays={relays()} user={npub()} />}
{anchor() && <zap-threads npubpro="true" reply-placeholder='Reply something...' anchor={anchor()} mode="dm" disable={disabled().join(',')} relays={relays()} user={npub()} />}
</div>
</>;
}
Expand Down
15 changes: 10 additions & 5 deletions embedded.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@

<link rel="stylesheet" href="./src/styles/index.css">
<link rel="stylesheet" href="./app/style.css">

<script src="./nostr-login.js" data-perms="sign_event:1985,sign_event:3,sign_event:30000" data-local-signup="false"></script>
<style>
zap-threads {
--ztr-link-color: #92379c;
--ztr-login-button-color: yellow;
/* --ztr-link-color: #92379c; */
/* --ztr-login-button-color: yellow; */
/* --ztr-icon-color: red; */
/* --ztr-text-color: red; */
/* --ztr-background-color: red; */

}

@media (prefers-color-scheme: dark) {
Expand Down Expand Up @@ -45,8 +49,9 @@ <h2>Sample article with embedded script</h2>
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>

<zap-threads anchor="https://fiatjaf.com/nostr.html"
user="npub1wf4pufsucer5va8g9p0rj5dnhvfeh6d8w0g6eayaep5dhps6rsgs43dgh9" disable="zaps,publish" />
<zap-threads npubpro="true" mode="chat" anchor="nevent1qqsq6g0tytafts9pysutk56ah9jguy65kytqx9mg6g2hnh2a2525pvcsxxw9v"
disable="zaps" />

</body>

</html>
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
<meta name="theme-color" content="#000000" />
<link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.png" />
<title>ZapThreads Sample App</title>
<script src="./nostr-login.js" data-perms="sign_event:1985,sign_event:3,sign_event:30000" data-local-signup="false"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>

<script src="/app/index.jsx" type="module"></script>
<script src="./app/index.jsx" type="module"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions nostr-login.js

Large diffs are not rendered by default.

Loading