mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Tweak code style
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
7a00541599
commit
7623dc7bad
@ -82,7 +82,7 @@ const convertToElectronMenuTemplate = (trayMenuItems: TrayMenuItem[]) => {
|
||||
|
||||
return {
|
||||
id: trayMenuItem.id,
|
||||
label: trayMenuItem.label.get(),
|
||||
label: trayMenuItem.label?.get(),
|
||||
enabled: trayMenuItem.enabled.get(),
|
||||
toolTip: trayMenuItem.tooltip,
|
||||
|
||||
|
||||
@ -16,11 +16,13 @@ import type { TrayMenuRegistration } from "../tray-menu-registration";
|
||||
const trayMenuItemRegistratorInjectable = getInjectable({
|
||||
id: "tray-menu-item-registrator",
|
||||
|
||||
instantiate: (di) => (extension: LensMainExtension, installationCounter) => {
|
||||
pipeline(
|
||||
extension.trayMenus,
|
||||
instantiate: (di) => (extension, installationCounter) => {
|
||||
const mainExtension = extension as LensMainExtension;
|
||||
|
||||
flatMap(toItemInjectablesFor(extension, installationCounter)),
|
||||
pipeline(
|
||||
mainExtension.trayMenus,
|
||||
|
||||
flatMap(toItemInjectablesFor(mainExtension, installationCounter)),
|
||||
|
||||
(injectables) => di.register(...injectables),
|
||||
);
|
||||
@ -34,7 +36,7 @@ export default trayMenuItemRegistratorInjectable;
|
||||
|
||||
const toItemInjectablesFor = (extension: LensMainExtension, installationCounter: number) => {
|
||||
const _toItemInjectables = (parentId: string | null) => (registration: TrayMenuRegistration): Injectable<TrayMenuItem, TrayMenuItem, void>[] => {
|
||||
const trayItemId = registration.id || kebabCase(registration.label);
|
||||
const trayItemId = registration.id || kebabCase(registration.label || "");
|
||||
const id = `${trayItemId}-tray-menu-item-for-extension-${extension.sanitizedExtensionId}-instance-${installationCounter}`;
|
||||
|
||||
const parentInjectable = getInjectable({
|
||||
@ -47,14 +49,14 @@ const toItemInjectablesFor = (extension: LensMainExtension, installationCounter:
|
||||
|
||||
separator: registration.type === "separator",
|
||||
|
||||
label: computed(() => registration.label),
|
||||
label: computed(() => registration.label || ""),
|
||||
tooltip: registration.toolTip,
|
||||
|
||||
click: () => {
|
||||
registration.click?.(registration);
|
||||
},
|
||||
|
||||
enabled: computed(() => registration.enabled),
|
||||
enabled: computed(() => !!registration.enabled),
|
||||
visible: computed(() => true),
|
||||
}),
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ const toTrayMenuOptions = (trayMenuItems: TrayMenuItem[]) => {
|
||||
|
||||
return {
|
||||
id: trayMenuItem.id,
|
||||
label: trayMenuItem.label.get(),
|
||||
label: trayMenuItem.label?.get(),
|
||||
enabled: trayMenuItem.enabled.get(),
|
||||
toolTip: trayMenuItem.tooltip,
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ const installApplicationUpdateTrayItemInjectable = getInjectable({
|
||||
orderNumber: 50,
|
||||
|
||||
label: computed(() => {
|
||||
const versionToBeInstalled = discoveredVersionState.value.get().version;
|
||||
const versionToBeInstalled = discoveredVersionState.value.get()?.version;
|
||||
|
||||
return `Install update ${versionToBeInstalled}`;
|
||||
}),
|
||||
@ -31,7 +31,7 @@ const installApplicationUpdateTrayItemInjectable = getInjectable({
|
||||
enabled: computed(() => true),
|
||||
|
||||
visible: computed(
|
||||
() => discoveredVersionState.value.get() && !downloadingUpdateState.value.get(),
|
||||
() => !!discoveredVersionState.value.get() && !downloadingUpdateState.value.get(),
|
||||
),
|
||||
|
||||
click: () => {
|
||||
|
||||
@ -27,7 +27,11 @@ const watchIfUpdateShouldHappenOnQuitInjectable = getInjectable({
|
||||
|
||||
const updateIsDiscoveredFromChannel = discoveredVersion?.updateChannel;
|
||||
|
||||
const updateOnQuit = sufficientlyStableUpdateChannels.includes(updateIsDiscoveredFromChannel);
|
||||
const updateOnQuit = updateIsDiscoveredFromChannel
|
||||
? sufficientlyStableUpdateChannels.includes(
|
||||
updateIsDiscoveredFromChannel,
|
||||
)
|
||||
: false;
|
||||
|
||||
setUpdateOnQuit(updateOnQuit);
|
||||
}),
|
||||
|
||||
@ -123,7 +123,7 @@ export const overrideIpcBridge = ({
|
||||
);
|
||||
|
||||
rendererDi.override(sendToMainInjectable, () => (channelId, message) => {
|
||||
const handles = mainIpcFakeHandles.get(channelId);
|
||||
const handles = mainIpcFakeHandles.get(channelId) || [];
|
||||
|
||||
if (isEmpty(handles)) {
|
||||
throw new Error(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user