mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 06:09:21 +01:00
Allow settings for unauthenticated sessions
This commit is contained in:
parent
dac07a35d8
commit
020d8e3631
2 changed files with 72 additions and 57 deletions
|
@ -234,6 +234,13 @@ function NavMenu(props) {
|
||||||
<MenuLink to="/login">
|
<MenuLink to="/login">
|
||||||
<Icon icon="user" size="l" /> <span>Log in</span>
|
<Icon icon="user" size="l" /> <span>Log in</span>
|
||||||
</MenuLink>
|
</MenuLink>
|
||||||
|
<MenuItem
|
||||||
|
onClick={() => {
|
||||||
|
states.showSettings = true;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon icon="gear" size="l" /> <span>Settings…</span>
|
||||||
|
</MenuItem>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -34,6 +34,7 @@ function Settings({ onClose }) {
|
||||||
const currentTextSize = store.local.get('textSize') || DEFAULT_TEXT_SIZE;
|
const currentTextSize = store.local.get('textSize') || DEFAULT_TEXT_SIZE;
|
||||||
|
|
||||||
const [prefs, setPrefs] = useState(store.account.get('preferences') || {});
|
const [prefs, setPrefs] = useState(store.account.get('preferences') || {});
|
||||||
|
const { masto, authenticated } = api();
|
||||||
// Get preferences every time Settings is opened
|
// Get preferences every time Settings is opened
|
||||||
// NOTE: Disabled for now because I don't expect this to change often. Also for some reason, the /api/v1/preferences endpoint is cached for a while and return old prefs if refresh immediately after changing them.
|
// NOTE: Disabled for now because I don't expect this to change often. Also for some reason, the /api/v1/preferences endpoint is cached for a while and return old prefs if refresh immediately after changing them.
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
|
@ -169,12 +170,16 @@ function Settings({ onClose }) {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
{authenticated && (
|
||||||
|
<>
|
||||||
<h3>Posting</h3>
|
<h3>Posting</h3>
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<div>
|
<div>
|
||||||
<label for="posting-privacy-field">Default visibility</label>
|
<label for="posting-privacy-field">
|
||||||
|
Default visibility
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<select
|
<select
|
||||||
|
@ -182,7 +187,6 @@ function Settings({ onClose }) {
|
||||||
value={prefs['posting:default:visibility'] || 'public'}
|
value={prefs['posting:default:visibility'] || 'public'}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const { value } = e.target;
|
const { value } = e.target;
|
||||||
const { masto } = api();
|
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await masto.v1.accounts.updateCredentials({
|
await masto.v1.accounts.updateCredentials({
|
||||||
|
@ -213,6 +217,8 @@ function Settings({ onClose }) {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<h3>Experiments</h3>
|
<h3>Experiments</h3>
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -384,6 +390,7 @@ function Settings({ onClose }) {
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
{authenticated && (
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -396,9 +403,10 @@ function Settings({ onClose }) {
|
||||||
Unsent drafts
|
Unsent drafts
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
<PushNotificationsSection onClose={onClose} />
|
{authenticated && <PushNotificationsSection onClose={onClose} />}
|
||||||
<h3>About</h3>
|
<h3>About</h3>
|
||||||
<section>
|
<section>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in a new issue