From 8deb849fa7fd1f661aaa706a05a32bc6569723e9 Mon Sep 17 00:00:00 2001 From: Hichem Fantar Date: Fri, 4 Oct 2024 02:14:50 +0100 Subject: [PATCH] Refactor app.tsx and index.ts in macapp/src to use APP_DISPLAY_NAME constant --- macapp/src/app.tsx | 3 ++- macapp/src/index.ts | 8 ++++---- macapp/src/utils.ts | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 macapp/src/utils.ts diff --git a/macapp/src/app.tsx b/macapp/src/app.tsx index 449fc851..4a0effd1 100644 --- a/macapp/src/app.tsx +++ b/macapp/src/app.tsx @@ -6,6 +6,7 @@ import { getCurrentWindow, app } from '@electron/remote' import { install } from './install' import OllamaIcon from './ollama.svg' +import { APP_DISPLAY_NAME } from './utils' const store = new Store() @@ -27,7 +28,7 @@ export default function () { {step === Step.WELCOME && ( <>
-

Welcome to Ollama

+

Welcome to {APP_DISPLAY_NAME}

Let's get you up and running with your own large language models.

diff --git a/macapp/src/index.ts b/macapp/src/index.ts index a5d04d5f..d86c3e65 100644 --- a/macapp/src/index.ts +++ b/macapp/src/index.ts @@ -7,6 +7,7 @@ import * as path from 'path' import { v4 as uuidv4 } from 'uuid' import { installed } from './install' +import { APP_DISPLAY_NAME } from './utils' require('@electron/remote/main').initialize() @@ -123,7 +124,7 @@ function updateTray() { tray = new Tray(trayIconPath()) } - tray.setToolTip(updateAvailable ? 'An update is available' : 'Ollama') + tray.setToolTip(updateAvailable ? 'An update is available' : APP_DISPLAY_NAME) tray.setContextMenu(menu) tray.setImage(trayIconPath()) @@ -223,7 +224,7 @@ function init() { const chosen = dialog.showMessageBoxSync({ type: 'question', buttons: ['Move to Applications', 'Do Not Move'], - message: 'Ollama works best when run from the Applications directory.', + message: `${APP_DISPLAY_NAME} works best when run from the Applications directory.`, defaultId: 0, cancelId: 1, }) @@ -236,8 +237,7 @@ function init() { dialog.showMessageBoxSync({ type: 'info', message: 'Cannot move to Applications directory', - detail: - 'Another version of Ollama is currently running from your Applications directory. Close it first and try again.', + detail: `Another version of ${APP_DISPLAY_NAME} is currently running from your Applications directory. Close it first and try again.`, }) } return true diff --git a/macapp/src/utils.ts b/macapp/src/utils.ts new file mode 100644 index 00000000..98752811 --- /dev/null +++ b/macapp/src/utils.ts @@ -0,0 +1,3 @@ +const APP_DISPLAY_NAME = 'Ollama' + +export { APP_DISPLAY_NAME }