-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New settings page layout with section sub-pages
- Loading branch information
Showing
29 changed files
with
1,531 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/components/SettingsSidebar/SettingsSidebar.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
@mixin heading { | ||
position: -webkit-sticky; | ||
position: sticky; | ||
top: 0px; | ||
width: 100%; | ||
height: 44px; | ||
// background-color: var(--background-site); | ||
background: var(--fade-gradient-vertical); | ||
z-index: 5; | ||
padding-bottom: 22px; | ||
display:flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-start; | ||
font-size: 18px; | ||
font-weight: 800; | ||
line-height: 22px; | ||
color: var(--text-secondary-2); | ||
text-transform: uppercase; | ||
>div{ | ||
display: flex; | ||
height: 22px; | ||
>span { | ||
color: var(--text-tertiary-2); | ||
text-transform: lowercase; | ||
margin-left: 6px; | ||
} | ||
} | ||
} | ||
|
||
.headingConnectedRelays { | ||
@include heading; | ||
} | ||
|
||
.headingCachingService { | ||
@include heading(); | ||
margin-top: 34px; | ||
z-index: 10px; | ||
} | ||
|
||
.relayEntry { | ||
display: flex; | ||
justify-content: flex-start; | ||
align-items: center; | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 28px; | ||
color: var(--text-secondary-2); | ||
text-align: left; | ||
|
||
.connected { | ||
background-color: #66E205; | ||
width: 6px; | ||
height: 6px; | ||
border-radius: 2px; | ||
margin-right: 8px; | ||
} | ||
|
||
.disconnected { | ||
background-color: #E20505; | ||
width: 6px; | ||
height: 6px; | ||
border-radius: 2px; | ||
margin-right: 8px; | ||
} | ||
|
||
.relayActions { | ||
display: flex; | ||
font-size: 12px; | ||
line-height: 12px; | ||
font-weight: 400; | ||
min-width: 100px; | ||
margin-left: 20px; | ||
|
||
>span { | ||
display: inline; | ||
} | ||
|
||
>button { | ||
border: none; | ||
background: none; | ||
font-size: 12px; | ||
line-height: 12px; | ||
font-weight: 400; | ||
margin: 2px; | ||
padding: 0px; | ||
color: var(--warning-color); | ||
display: none; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
&:hover { | ||
>span { | ||
display: inline; | ||
} | ||
>button { | ||
display: flex; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { useIntl } from '@cookbook/solid-intl'; | ||
import { Component, For, Show } from 'solid-js'; | ||
import { useAccountContext } from '../../contexts/AccountContext'; | ||
import { settings as t } from '../../translations'; | ||
|
||
// @ts-ignore Bad types in nostr-tools | ||
import { Relay, relayInit } from "nostr-tools"; | ||
|
||
import styles from './SettingsSidebar.module.scss'; | ||
import { cacheServer, isConnected, socket } from '../../sockets'; | ||
|
||
const SettingsSidebar: Component = () => { | ||
|
||
const intl = useIntl(); | ||
const account = useAccountContext(); | ||
|
||
const connectedRelays = () => account?.relays || []; | ||
|
||
const disconnectedRelays = () => { | ||
const allRelayUrls = Object.keys(account?.relaySettings || {}); | ||
const connectedUrls = connectedRelays().map(r => r.url); | ||
|
||
return allRelayUrls.reduce( | ||
(acc: Relay[], url) => connectedUrls.includes(url) ? acc : [...acc, relayInit(url)], | ||
[], | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
<div class={styles.headingConnectedRelays}> | ||
<div> | ||
{intl.formatMessage(t.relays)} | ||
</div> | ||
</div> | ||
|
||
<For each={connectedRelays()}> | ||
{relay => ( | ||
<div class={styles.relayEntry}> | ||
<div class={styles.connected}></div> | ||
<span> | ||
{relay.url} | ||
</span> | ||
</div> | ||
)} | ||
</For> | ||
<For each={disconnectedRelays()}> | ||
{relay => ( | ||
<div class={styles.relayEntry}> | ||
<div class={styles.disconnected}></div> | ||
<span> | ||
{relay.url} | ||
</span> | ||
</div> | ||
)} | ||
</For> | ||
|
||
<div class={styles.headingCachingService}> | ||
<div> | ||
{intl.formatMessage(t.cashingService)} | ||
</div> | ||
</div> | ||
|
||
<div class={styles.relayEntry}> | ||
<Show | ||
when={isConnected()} | ||
fallback={<div class={styles.disconnected}></div>} | ||
> | ||
<div class={styles.connected}></div> | ||
</Show> | ||
<span> | ||
{socket()?.url || cacheServer} | ||
</span> | ||
</div> | ||
</> | ||
) | ||
} | ||
|
||
export default SettingsSidebar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.