mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-01 19:46:36 +03:00
prefs: use sync.pike to discern if OTAs enabled
Also, remove the conditional rendering logic for AppPrefs. With the new logic (and before this change) if the User disables OTAs, the toggle would disappear, which feels like an antipattern.
This commit is contained in:
parent
d99dc3e3ab
commit
2887008487
@ -10,8 +10,7 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
|
||||
const { desk } = match.params;
|
||||
const charge = useCharge(desk);
|
||||
const pike = usePike(desk);
|
||||
const tracking = !!pike?.sync;
|
||||
const otasEnabled = pike?.zest === 'live';
|
||||
const otasEnabled = !!pike?.sync;
|
||||
const otaSource = pike?.sync?.ship;
|
||||
const toggleOTAs = useKilnState((s) => s.toggleOTAs);
|
||||
|
||||
@ -21,18 +20,14 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
|
||||
<>
|
||||
<h2 className="h3 mb-7">{getAppName(charge)} Settings</h2>
|
||||
<div className="space-y-3">
|
||||
{tracking ? (
|
||||
<Setting on={otasEnabled} toggle={toggleUpdates} name="Automatic Updates">
|
||||
<p>Automatically download and apply updates to keep {getAppName(charge)} up to date.</p>
|
||||
{otaSource && (
|
||||
<p>
|
||||
OTA Source: <ShipName name={otaSource} className="font-semibold font-mono" />
|
||||
</p>
|
||||
)}
|
||||
</Setting>
|
||||
) : (
|
||||
<h4 className="text-gray-500">No settings</h4>
|
||||
)}
|
||||
<Setting on={otasEnabled} toggle={toggleUpdates} name="Automatic Updates">
|
||||
<p>Automatically download and apply updates to keep {getAppName(charge)} up to date.</p>
|
||||
{otaSource && (
|
||||
<p>
|
||||
OTA Source: <ShipName name={otaSource} className="font-semibold font-mono" />
|
||||
</p>
|
||||
)}
|
||||
</Setting>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
@ -12,7 +12,7 @@ export const SystemUpdatePrefs = () => {
|
||||
_.pick(s, ['toggleOTAs', 'changeOTASource'])
|
||||
);
|
||||
const pike = usePike('base');
|
||||
const otasEnabled = pike?.zest === 'live';
|
||||
const otasEnabled = !!pike?.sync;
|
||||
const otaSource = pike?.sync?.ship;
|
||||
|
||||
const toggleBase = useCallback((on: boolean) => toggleOTAs('base', on), [toggleOTAs]);
|
||||
|
Loading…
Reference in New Issue
Block a user