Settings: prefetching toots
This commit is contained in:
		
							parent
							
								
									cbed46ae77
								
							
						
					
					
						commit
						6ad794eae5
					
				
					 3 changed files with 19 additions and 4 deletions
				
			
		|  | @ -23,9 +23,12 @@ import { css } from "solid-styled"; | |||
| import { useSignedInProfiles } from "../masto/acct.js"; | ||||
| import { signOut, type Account } from "../accounts/stores.js"; | ||||
| import { intlFormat } from "date-fns"; | ||||
| import { useStore } from "@nanostores/solid"; | ||||
| import { $settings } from "./stores.js"; | ||||
| 
 | ||||
| const Settings: ParentComponent = () => { | ||||
|   const navigate = useNavigate(); | ||||
|   const settings$ = useStore($settings); | ||||
| 
 | ||||
|   const [profiles] = useSignedInProfiles(); | ||||
| 
 | ||||
|  | @ -96,7 +99,12 @@ const Settings: ParentComponent = () => { | |||
|               Prefetch Toots | ||||
|             </ListItemText> | ||||
|             <ListItemSecondaryAction> | ||||
|               <Switch /> | ||||
|               <Switch | ||||
|                 checked={!settings$().prefetchTootsDisabled} | ||||
|                 onChange={(e) => | ||||
|                   $settings.setKey("prefetchTootsDisabled", !e.target.checked) | ||||
|                 } | ||||
|               /> | ||||
|             </ListItemSecondaryAction> | ||||
|           </ListItem> | ||||
|         </li> | ||||
|  |  | |||
|  | @ -2,6 +2,10 @@ import { persistentMap } from "@nanostores/persistent"; | |||
| 
 | ||||
| type Settings = { | ||||
|   onGoingOAuth2Process?: string | ||||
|   prefetchTootsDisabled?: boolean | ||||
| } | ||||
| 
 | ||||
| export const $settings = persistentMap<Settings>("settings::", {}) | ||||
| export const $settings = persistentMap<Settings>("settings::", {}, { | ||||
|   encode: JSON.stringify, | ||||
|   decode: JSON.parse | ||||
| }) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue