| 1 | {{define "chat" }}<section id="chat" > |
| 2 | <h1>Chat</h1> |
| 3 | <p>Direct conversations and group rooms.</p> |
| 4 | <h2 id="new-chat" >Direct chats</h2> |
| 5 | {{if .Actor}}<direct-start><label>Start a conversation <input name="peer" required placeholder="npub or public key" autocomplete="off" spellcheck="false" ></label><button>New chat</button></direct-start> |
| 6 | <direct-chats actor="{{.Actor}}" relay="{{wsURL .URL}}" ><p>Connect your signer to open your encrypted conversations.</p></direct-chats> |
| 7 | <noscript><p>Direct chats need JavaScript and a signer that supports NIP-44 encryption. Group rooms are available below.</p></noscript> |
| 8 | {{else}}<p><a href="{{signinURL .Base .Path .Query}}" >Sign in</a> to open your direct chats.</p>{{end}} |
| 9 | <h2>Rooms</h2> |
| 10 | {{template "roomList" .}} |
| 11 | </section>{{end}} |
| 12 | |
| 13 | {{define "direct" }}<section id="direct-chat" > |
| 14 | <header><h1>{{template "nostrName" .View}}</h1><p>Private conversation. Only you and this person can read these messages.</p></header> |
| 15 | {{if .Actor}}<direct-thread actor="{{.Actor}}" peer="{{.View}}" relay="{{wsURL .URL}}" ><p>Connect your signer to decrypt this conversation.</p></direct-thread> |
| 16 | <direct-compose actor="{{.Actor}}" peer="{{.View}}" relay="{{wsURL .URL}}" ><label for="direct-content" >Message</label><textarea id="direct-content" name="content" rows="2" required title="Enter to send; Shift+Enter for a new line" placeholder="Write a private messageā¦" ></textarea><button type="submit" >Send</button></direct-compose> |
| 17 | <noscript><p>Reading and sending direct messages needs JavaScript and a signer that supports NIP-44 encryption.</p></noscript> |
| 18 | {{else}}<p><a href="{{signinURL .Base .Path .Query}}" >Sign in</a> to open this private conversation.</p>{{end}} |
| 19 | </section>{{end}} |
| 20 | |
| 21 | {{define "panel-chat" }}<section><h4>Direct messages</h4><p>Encrypted for you and the recipient. Your signer opens messages delivered to this relay.</p> |
| 22 | {{if .Actor}}<direct-settings actor="{{.Actor}}" relay="{{wsURL .URL}}" ></direct-settings><p><small>Add this relay to your message relay list so other Nostr clients know where to reach you.</small></p>{{end}}</section> |
| 23 | {{if .Actor}}<section><h4>Notifications</h4><push-toggle></push-toggle><p><small>Chat and approval notices on this device.</small></p><noscript><p>Enabling notifications needs JavaScript.</p></noscript></section>{{end}} |
| 24 | <section><h4>Group rooms</h4><p>Open rooms are visible to everyone. Members-only rooms are visible to their members and relay moderators.</p><a href="/chat#new-room" >Create a room</a></section>{{end}} |