mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
782e613506
- GPX files drop onto the map or a day; the import lands on that day - wanderer connection per user in Integrations; the workspace offers the user's own trails only, behind an admin switch under the Tours addon - wanderer difficulty is stored on the SAC scale (T1 to T3), backfilled - a GPX or wanderer import can be planned as an editable tour, either in place (the recorded track is kept and can be restored) or as a new tour that remembers the import it came from - rails, rows and detail dialog follow the plan sidebar's cards and badges - admin addon shelves with more than one row fold, collapsed by default - reverse-geocoded waypoint names are cached on the device
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { useEffect } from 'react';
|
|
import { useAddonStore } from '../../store/addonStore';
|
|
import { useAuthStore } from '../../store/authStore';
|
|
|
|
/**
|
|
* Which integrations the settings shells offer: the addon flags behind each
|
|
* integration section, whether any of them is on, and whether this is a managed
|
|
* install. The desktop Integrations tab shows regardless, since its API keys need
|
|
* no addon; the mobile one has no API keys and only shows when `hasIntegrations`.
|
|
* With `reloadAddons` the addon list is fetched again on mount, as the
|
|
* integrations tab on both shells does.
|
|
*/
|
|
export function useIntegrationGates({ reloadAddons }: { reloadAddons: boolean }) {
|
|
const { isEnabled: addonEnabled, loadAddons } = useAddonStore();
|
|
const managed = useAuthStore((s) => s.managed);
|
|
|
|
const memoriesEnabled = addonEnabled('memories');
|
|
const mcpEnabled = addonEnabled('mcp');
|
|
const airtrailEnabled = addonEnabled('airtrail');
|
|
const llmEnabled = addonEnabled('llm_parsing');
|
|
const dawarichEnabled = addonEnabled('dawarich');
|
|
// The wanderer connection feeds the Tours workspace, while the admin allows it there.
|
|
const wandererEnabled = useAddonStore((s) => s.toursWanderer);
|
|
const hasIntegrations = memoriesEnabled || mcpEnabled || airtrailEnabled || llmEnabled || dawarichEnabled;
|
|
|
|
useEffect(() => {
|
|
if (reloadAddons) loadAddons();
|
|
}, [loadAddons, reloadAddons]);
|
|
|
|
return {
|
|
memoriesEnabled,
|
|
mcpEnabled,
|
|
airtrailEnabled,
|
|
llmEnabled,
|
|
dawarichEnabled,
|
|
wandererEnabled,
|
|
hasIntegrations,
|
|
managed,
|
|
loadAddons,
|
|
};
|
|
}
|