|
| 1 | +export const sidebarItems = [ |
| 2 | + { key: "landing", mode: "disconnected", i18n: "tabLanding", icon: "i-lucide-home" }, |
| 3 | + { key: "help", mode: "disconnected", i18n: "tabHelp", icon: "i-lucide-help-circle" }, |
| 4 | + { key: "options", mode: "disconnected", i18n: "tabOptions", icon: "i-lucide-settings" }, |
| 5 | + { key: "firmware_flasher", mode: "disconnected", i18n: "tabFirmwareFlasher", icon: "i-lucide-zap" }, |
| 6 | + { key: "preflight", mode: "disconnected", i18n: "tabPreflight", icon: "i-lucide-clipboard-check" }, |
| 7 | + { key: "flight_plan", mode: "disconnected", i18n: "tabFlightPlan", icon: "i-lucide-route", expert: true }, |
| 8 | + |
| 9 | + { key: "setup", mode: "connected", i18n: "tabSetup", icon: "i-lucide-sliders-horizontal" }, |
| 10 | + { key: "ports", mode: "connected", i18n: "tabPorts", icon: "i-lucide-cable" }, |
| 11 | + { key: "configuration", mode: "connected", i18n: "tabConfiguration", icon: "i-lucide-settings" }, |
| 12 | + { key: "power", mode: "connected", i18n: "tabPower", icon: "i-lucide-battery" }, |
| 13 | + { key: "failsafe", mode: "connected", i18n: "tabFailsafe", icon: "i-lucide-shield-alert", expert: true }, |
| 14 | + { key: "presets", mode: "connected", i18n: "tabPresets", icon: "i-lucide-wand-2" }, |
| 15 | + { key: "pid_tuning", mode: "connected", i18n: "tabPidTuning", icon: "i-lucide-gauge" }, |
| 16 | + { key: "receiver", mode: "connected", i18n: "tabReceiver", icon: "i-lucide-radio" }, |
| 17 | + { key: "auxiliary", mode: "connected", i18n: "tabAuxiliary", icon: "i-lucide-toggle-right" }, |
| 18 | + { key: "adjustments", mode: "connected", i18n: "tabAdjustments", icon: "i-lucide-sliders", expert: true }, |
| 19 | + { |
| 20 | + key: "servos", |
| 21 | + mode: "connected", |
| 22 | + i18n: "tabServos", |
| 23 | + icon: "i-lucide-rotate-ccw", |
| 24 | + buildOptions: ["USE_SERVOS", "USE_WING"], |
| 25 | + }, |
| 26 | + { key: "gps", mode: "connected", i18n: "tabGPS", icon: "i-lucide-map-pin", buildOptions: ["USE_GPS"] }, |
| 27 | + { key: "motors", mode: "connected", i18n: "tabMotorTesting", icon: "i-lucide-fan" }, |
| 28 | + { key: "osd", mode: "connected", i18n: "tabOsd", icon: "i-lucide-monitor", feature: "OSD" }, |
| 29 | + { key: "vtx", mode: "connected", i18n: "tabVtx", icon: "i-lucide-radio-tower" }, |
| 30 | + { key: "led_strip", mode: "connected", i18n: "tabLedStrip", icon: "i-lucide-lightbulb", feature: "LED_STRIP" }, |
| 31 | + { key: "sensors", mode: "connected", i18n: "tabRawSensorData", icon: "i-lucide-activity", expert: true }, |
| 32 | + { |
| 33 | + key: "flight_plan_connected", |
| 34 | + tab: "flight_plan", |
| 35 | + mode: "connected", |
| 36 | + i18n: "tabFlightPlan", |
| 37 | + icon: "i-lucide-route", |
| 38 | + buildOptions: ["USE_FLIGHT_PLAN"], |
| 39 | + }, |
| 40 | + { key: "logging", mode: "connected", i18n: "tabLogging", icon: "i-lucide-file-text", expert: true }, |
| 41 | + { key: "onboard_logging", mode: "connected", i18n: "tabOnboardLogging", icon: "i-lucide-database" }, |
| 42 | + |
| 43 | + { key: "cli", mode: "cli", i18n: "tabCLI", icon: "i-lucide-terminal" }, |
| 44 | + |
| 45 | + { key: "log", mode: "shared", i18n: "tabLog", icon: "i-lucide-file-text", expert: true }, |
| 46 | + |
| 47 | + { key: "backups", mode: "loggedin", i18n: "tabBackups", icon: "i-lucide-database" }, |
| 48 | + { key: "user_profile", mode: "loggedin", i18n: "tabUserProfile", icon: "i-lucide-user" }, |
| 49 | +]; |
| 50 | + |
| 51 | +export function isItemVisible(item, ctx) { |
| 52 | + if (item.expert && !ctx.expertMode) { |
| 53 | + return false; |
| 54 | + } |
| 55 | + if (item.buildOptions && !item.buildOptions.some((o) => ctx.buildOptions?.includes(o))) { |
| 56 | + return false; |
| 57 | + } |
| 58 | + if (item.feature && !ctx.features?.isEnabled?.(item.feature)) { |
| 59 | + return false; |
| 60 | + } |
| 61 | + return true; |
| 62 | +} |
0 commit comments