Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/ssh-port-forward.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$ErrorActionPreference = "Stop"

$sshTarget = "guang@192.168.31.169"
$ports = 5001, 5050, 8080, 2222, 8082, 3306, 5432
$ports = 5001, 5050, 8080, 2222, 8082, 3306, 5432, 8888

$sshArguments = @(
"-N"
Expand Down
2 changes: 2 additions & 0 deletions ui/components/Header/DesktopTitleBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ const windowControls = computed(() => [
</div>
</div>

<slot name="trailing" />

<div class="flex h-full shrink-0 items-stretch">
<UButton
v-for="button in windowControls"
Expand Down
57 changes: 57 additions & 0 deletions ui/components/Header/header.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import ts from "typescript";
import { expect, it } from "vitest";
import { computed, ref } from "vue";
import source from "./header.vue?raw";

it("keeps guest tools accessible while hiding only the empty Windows workspace bar", () => {
const desktop = ref(true);
const isWindows = ref(true);
const loggedIn = ref(false);
const focusMode = ref(false);
const tabs = ref<object[]>([]);
const path = ref("/");
const script = source.match(/<script setup lang="ts">([\s\S]*?)<\/script>/)![1]!;
const { outputText } = ts.transpileModule(script, { compilerOptions: { module: ts.ModuleKind.CommonJS } });
const scope = {
exports: {},
require: () => ({ useUserInfoStore: () => ({ loggedIn }) }),
computed,
storeToRefs: (store: unknown) => store,
useRouter: () => ({ currentRoute: computed(() => ({ path: path.value })) }),
useLocalePath: () => (value: unknown) => value,
useI18n: () => ({ t: (key: string) => key }),
usePlatform: () => ({ isMacOS: computed(() => !isWindows.value), isWindows }),
useWorkspaceMode: () => ({ activeWorkspaceMode: ref("assets") }),
useWorkspaceTabs: () => ({ focusMode, tabs, workspaceFullscreen: ref(false) }),
isDesktopRuntime: () => desktop.value
};
const header = new Function(
...Object.keys(scope),
`${outputText}; return { showTitleBarMenu, showWorkspaceHeader };`
)(...Object.values(scope));

expect(header.showTitleBarMenu.value).toBe(true);
expect(header.showWorkspaceHeader.value).toBe(false);
for (const tool of ["/videoplayer", "/tools", "/transcode", "/face"]) {
path.value = tool;
expect(header.showWorkspaceHeader.value).toBe(true);
}
path.value = "/";
tabs.value = [{}];
expect(header.showWorkspaceHeader.value).toBe(true);
focusMode.value = true;
expect(header.showWorkspaceHeader.value).toBe(false);
focusMode.value = false;
tabs.value = [];
loggedIn.value = true;
expect(header.showTitleBarMenu.value).toBe(false);
expect(header.showWorkspaceHeader.value).toBe(true);
loggedIn.value = false;
desktop.value = false;
expect(header.showTitleBarMenu.value).toBe(false);
expect(header.showWorkspaceHeader.value).toBe(true);
desktop.value = true;
isWindows.value = false;
expect(header.showTitleBarMenu.value).toBe(false);
expect(header.showWorkspaceHeader.value).toBe(true);
});
17 changes: 13 additions & 4 deletions ui/components/Header/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { useUserInfoStore } from "~/store/modules/userInfo";
const router = useRouter();
const localePath = useLocalePath();
const { t } = useI18n();
const { isMacOS } = usePlatform();
const { isMacOS, isWindows } = usePlatform();
const { activeWorkspaceMode } = useWorkspaceMode();
const userInfoStore = useUserInfoStore();
const { loggedIn } = storeToRefs(userInfoStore);
const { exitFocusMode, focusMode, tabs, workspaceFullscreen } = useWorkspaceTabs();
const hasMacTrafficLightInset = computed(() => isDesktopRuntime() && isMacOS.value);
const showWorkspaceHeader = computed(() => !focusMode.value);
const showTitleBarMenu = computed(() => isDesktopRuntime() && isWindows.value && !loggedIn.value);
const isToolRoute = computed(() => {
const path = router.currentRoute.value.path.toLowerCase();
return (
Expand All @@ -24,6 +24,9 @@ const showSidebarChrome = computed(() => loggedIn.value && !isToolRoute.value);
const showAssetTabs = computed(
() => activeWorkspaceMode.value === "assets" && (loggedIn.value || tabs.value.length > 0)
);
const showWorkspaceHeader = computed(
() => !focusMode.value && (!showTitleBarMenu.value || showAssetTabs.value || isToolRoute.value)
);

const returnFromTool = async () => {
if (!loggedIn.value) {
Expand Down Expand Up @@ -77,7 +80,13 @@ const pageHeader = computed(() => {

<template>
<div>
<HeaderDesktopTitleBar />
<HeaderDesktopTitleBar>
<template v-if="showTitleBarMenu" #trailing>
<div class="flex items-center px-2" data-desktop-drag-region="false">
<SideBarProfile />
</div>
</template>
</HeaderDesktopTitleBar>
<div
v-if="hasMacTrafficLightInset && !showWorkspaceHeader && !workspaceFullscreen"
data-desktop-drag-region
Expand All @@ -95,7 +104,7 @@ const pageHeader = computed(() => {
@click="exitFocusMode"
/>
</div>
<WorkspaceTopHeader v-show="showWorkspaceHeader">
<WorkspaceTopHeader v-show="showWorkspaceHeader" :show-profile="!showTitleBarMenu">
<template v-if="showSidebarChrome" #leading>
<SideBarTopControls />
</template>
Expand Down
3 changes: 2 additions & 1 deletion ui/components/SideBar/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const enableLoginBtnAfter = (ms: number) => {
};

const accountTooltip = computed(() => {
if (!loggedIn.value) return t("Common.More");
if (loggedIn.value && currentUser.value?.name) return currentUser.value.name;
return t("Common.Account");
});
Expand Down Expand Up @@ -971,7 +972,7 @@ onBeforeUnmount(() => {
@pointerdown="profileOpenedByPointer = true"
@keydown="profileOpenedByPointer = false"
>
<UIcon :name="loggedIn ? 'i-lucide-circle-user-round' : 'i-lucide-user-round'" class="size-4" />
<UIcon :name="loggedIn ? 'i-lucide-circle-user-round' : 'i-lucide-menu'" class="size-4" />
</UButton>
</UTooltip>

Expand Down
6 changes: 4 additions & 2 deletions ui/components/Workspace/topHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const props = withDefaults(defineProps<{ showActions?: boolean; showProfile?: bo
});
const { collapse, modernIsland } = useSettingManager();
const { sidebarWidth } = useSidebarLayout();
const { isWindows, isLoading } = usePlatform();
const canDragWindow = computed(() => isDesktopRuntime() && !isLoading.value && !isWindows.value);
const isNarrowScreen = useMediaQuery("(max-width: 767px)");
const leadingAreaStyle = computed(() => {
if (collapse.value || isNarrowScreen.value) return { width: "fit-content" };
Expand All @@ -19,7 +21,7 @@ const leadingAreaStyle = computed(() => {
});

const handleWindowDrag = async (event: MouseEvent) => {
if (!isDesktopRuntime()) return;
if (!canDragWindow.value) return;

const target = event.target as HTMLElement;
if (
Expand All @@ -43,7 +45,7 @@ const handleWindowDrag = async (event: MouseEvent) => {

<template>
<div
data-desktop-drag-region
:data-desktop-drag-region="canDragWindow"
class="header-bg h-10 min-h-10 max-h-10 shrink-0 flex items-center"
:style="{
backgroundColor: 'var(--app-header-bg)',
Expand Down
Loading