-
-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74b7509
commit 3eb5955
Showing
11 changed files
with
313 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,5 +43,6 @@ | |
"packages/app" | ||
], | ||
"dependencies": { | ||
"react-responsive": "^10.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
packages/app/src/components/toolbars/bottom-bar/BottomMenuItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { ReactNode } from 'react' | ||
import { EditorView } from '@aitube/clapper-services' | ||
|
||
import { cn } from '@/lib/utils' | ||
import { useEditors } from '@/services/editors/useEditors' | ||
import { useTheme } from '@/services/ui/useTheme' | ||
import { useUI } from '@/services' | ||
|
||
export function BottomMenuItem({ | ||
children, | ||
view: expectedView, | ||
label, | ||
onClick, | ||
}: { | ||
children: ReactNode | ||
|
||
/** | ||
* Name of the menu item | ||
*/ | ||
view?: EditorView | ||
|
||
/** | ||
* Label of the tooltip | ||
*/ | ||
label?: string | ||
|
||
/** | ||
* Custom handler | ||
*/ | ||
onClick?: () => void | ||
}) { | ||
const theme = useTheme() | ||
const view = useEditors((s) => s.view) | ||
const setView = useEditors((s) => s.setView) | ||
const setShowExplorer = useUI((s) => s.setShowExplorer) | ||
const setShowVideoPlayer = useUI((s) => s.setShowVideoPlayer) | ||
|
||
const isActive = view === expectedView | ||
|
||
const tooltipLabel = label || expectedView | ||
|
||
const handleClick = () => { | ||
onClick?.() | ||
|
||
// nothing to do if there is no name or if we are already selecterd | ||
if (!expectedView || isActive) { | ||
return | ||
} | ||
setView(expectedView) | ||
setShowExplorer(true) | ||
setShowVideoPlayer(false) | ||
} | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
`flex flex-col`, | ||
`transition-all duration-150 ease-out`, | ||
`items-center justify-center`, | ||
isActive ? '' : `cursor-pointer`, | ||
`transition-all duration-200 ease-in-out`, | ||
isActive | ||
? 'fill-neutral-50/80 text-neutral-50 opacity-100 hover:fill-neutral-50 hover:text-neutral-50' | ||
: 'fill-neutral-400/80 text-gray-400 opacity-80 hover:fill-neutral-200 hover:text-neutral-200 hover:opacity-100', | ||
`group` | ||
)} | ||
onClick={handleClick} | ||
> | ||
<div | ||
className={cn( | ||
`flex flex-col items-center justify-center`, | ||
`text-center`, | ||
`h-11 w-11 text-[32px]`, | ||
`transition-all duration-200 ease-out`, | ||
`stroke-1`, | ||
isActive ? `scale-110` : `group-hover:scale-110` | ||
)} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
) | ||
} |
64 changes: 64 additions & 0 deletions
64
packages/app/src/components/toolbars/bottom-bar/DesktopBottomBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { cn } from '@/lib/utils' | ||
import { useTheme } from '@/services/ui/useTheme' | ||
|
||
import { APP_REVISION } from '@/lib/core/constants' | ||
import { Tasks } from './tasks' | ||
import { useTimeline } from '@aitube/timeline' | ||
import { TimelineZoom } from '@/components/core/timeline/TimelineZoom' | ||
|
||
export function DesktopBottomBar() { | ||
const theme = useTheme() | ||
const bpm = useTimeline((s) => s.bpm) | ||
const frameRate = useTimeline((s) => s.frameRate) | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
`hidden flex-row md:flex`, | ||
`items-center justify-between`, | ||
`h-7 w-full px-3`, | ||
`text-xs font-light text-white/40` | ||
)} | ||
style={{ | ||
borderTop: 'solid 1px rgba(255,255,255,0.3)', | ||
backgroundColor: | ||
theme.editorMenuBgColor || theme.defaultBgColor || '#afafaf', | ||
// borderTopColor: theme.editorTextColor || theme.defaultBorderColor || "#bfbfbf", | ||
color: theme.editorTextColor || theme.defaultTextColor || '#ffffff', | ||
}} | ||
> | ||
<div className="flex flex-row space-x-3"> | ||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">app version:</span> | ||
<span className="text-white/55">{APP_REVISION}</span> | ||
</div> | ||
|
||
{/* | ||
Note sure that's really useful since there is a garbage collector, | ||
I got a situation where I had 1.2 Gb when loaded empty, | ||
and it turned into 800 Mb after loading a big project, | ||
thanks to the GC kicking in. | ||
what would be more useful is to collect system metrics in the Desktop version. | ||
<Metrics /> | ||
*/} | ||
|
||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">BPM:</span> | ||
<span className="text-white/55">{Math.round(bpm * 1000) / 1000}</span> | ||
</div> | ||
|
||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">FPS:</span> | ||
<span className="text-white/55"> | ||
{Math.round(frameRate * 1000) / 1000} | ||
</span> | ||
</div> | ||
</div> | ||
<div className="flex flex-row space-x-6"> | ||
<TimelineZoom /> | ||
<Tasks /> | ||
</div> | ||
</div> | ||
) | ||
} |
99 changes: 99 additions & 0 deletions
99
packages/app/src/components/toolbars/bottom-bar/MobileBottomBar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { CiViewTimeline } from 'react-icons/ci' | ||
import { MdMovieEdit } from 'react-icons/md' | ||
import { GoVideo } from 'react-icons/go' | ||
import { GrUserSettings } from 'react-icons/gr' | ||
import { PiBookOpenTextLight, PiTreeStructureLight } from 'react-icons/pi' | ||
import { EditorView, SettingsCategory } from '@aitube/clapper-services' | ||
|
||
import { cn } from '@/lib/utils' | ||
import { useEditors, useUI } from '@/services' | ||
import { useTheme } from '@/services/ui/useTheme' | ||
|
||
import { NatureIcon } from '../editors-menu/NatureIcon' | ||
import { BottomMenuItem } from './BottomMenuItem' | ||
import { useEffect } from 'react' | ||
import { useBreakpoints } from '@/lib/hooks/useBreakpoints' | ||
|
||
export function MobileBottomBar() { | ||
const theme = useTheme() | ||
const setView = useEditors((s) => s.setView) | ||
const setShowExplorer = useUI((s) => s.setShowExplorer) | ||
const setShowVideoPlayer = useUI((s) => s.setShowVideoPlayer) | ||
const setShowAssistant = useUI((s) => s.setShowAssistant) | ||
const setShowSettings = useUI((s) => s.setShowSettings) | ||
|
||
const { isMd } = useBreakpoints() | ||
|
||
useEffect(() => { | ||
if (isMd) { | ||
setShowExplorer(true) | ||
setShowVideoPlayer(true) | ||
} else { | ||
setShowAssistant(false) | ||
setShowExplorer(false) | ||
setShowVideoPlayer(true) | ||
} | ||
}, [isMd]) | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
`flex flex-row md:hidden`, | ||
`items-center justify-between`, | ||
`h-12 w-full px-3`, | ||
`border-t`, | ||
`text-xs font-light text-white/40`, | ||
`transition-all duration-200 ease-in-out` | ||
)} | ||
style={{ | ||
backgroundColor: | ||
theme.editorMenuBgColor || theme.defaultBgColor || '#eeeeee', | ||
borderTopColor: | ||
theme.editorBorderColor || theme.defaultBorderColor || '#eeeeee', | ||
}} | ||
> | ||
<BottomMenuItem | ||
view={EditorView.PROJECT} | ||
label="Project settings" | ||
onClick={() => { | ||
setShowExplorer(false) | ||
}} | ||
> | ||
<MdMovieEdit /> | ||
</BottomMenuItem> | ||
<BottomMenuItem view={EditorView.SCRIPT} label="Story"> | ||
<PiBookOpenTextLight /> | ||
</BottomMenuItem> | ||
<BottomMenuItem view={EditorView.ENTITY} label="Entities"> | ||
<NatureIcon /> | ||
</BottomMenuItem> | ||
<BottomMenuItem view={EditorView.SEGMENT} label="Segment editor"> | ||
<CiViewTimeline /> | ||
</BottomMenuItem> | ||
<BottomMenuItem | ||
view={EditorView.WORKFLOW} | ||
label="Workflows" | ||
onClick={() => { | ||
setShowExplorer(false) | ||
}} | ||
> | ||
<PiTreeStructureLight /> | ||
</BottomMenuItem> | ||
<BottomMenuItem | ||
label="Monitor" | ||
onClick={() => { | ||
setShowExplorer(false) | ||
setShowVideoPlayer(true) | ||
}} | ||
> | ||
<GoVideo /> | ||
</BottomMenuItem> | ||
<BottomMenuItem | ||
label="Preferences" | ||
onClick={() => setShowSettings(SettingsCategory.PROVIDER)} | ||
> | ||
<GrUserSettings className="h-6 w-6" /> | ||
</BottomMenuItem> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,19 @@ | ||
import { cn } from '@/lib/utils' | ||
import { useTheme } from '@/services/ui/useTheme' | ||
|
||
import { Metrics } from './metrics' | ||
import { APP_REVISION } from '@/lib/core/constants' | ||
import { Tasks } from './tasks' | ||
import { useTimeline } from '@aitube/timeline' | ||
import { TimelineZoom } from '@/components/core/timeline/TimelineZoom' | ||
|
||
export function BottomToolbar() { | ||
const theme = useTheme() | ||
const bpm = useTimeline((s) => s.bpm) | ||
const frameRate = useTimeline((s) => s.frameRate) | ||
import { DesktopBottomBar } from './DesktopBottomBar' | ||
import { MobileBottomBar } from './MobileBottomBar' | ||
|
||
export function BottomBar() { | ||
return ( | ||
<div | ||
className={cn( | ||
`absolute bottom-0 flex flex-row`, | ||
`items-center justify-between`, | ||
`left-0 right-0 h-7`, | ||
`px-3`, | ||
`text-xs font-light text-white/40` | ||
`left-0 right-0` | ||
)} | ||
style={{ | ||
borderTop: 'solid 1px rgba(255,255,255,0.3)', | ||
backgroundColor: | ||
theme.editorMenuBgColor || theme.defaultBgColor || '#afafaf', | ||
// borderTopColor: theme.editorTextColor || theme.defaultBorderColor || "#bfbfbf", | ||
color: theme.editorTextColor || theme.defaultTextColor || '#ffffff', | ||
}} | ||
> | ||
<div className="flex flex-row space-x-3"> | ||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">app version:</span> | ||
<span className="text-white/55">{APP_REVISION}</span> | ||
</div> | ||
|
||
{/* | ||
Note sure that's really useful since there is a garbage collector, | ||
I got a situation where I had 1.2 Gb when loaded empty, | ||
and it turned into 800 Mb after loading a big project, | ||
thanks to the GC kicking in. | ||
what would be more useful is to collect system metrics in the Desktop version. | ||
<Metrics /> | ||
*/} | ||
|
||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">BPM:</span> | ||
<span className="text-white/55">{Math.round(bpm * 1000) / 1000}</span> | ||
</div> | ||
|
||
<div className="flex flex-row space-x-1"> | ||
<span className="text-white/40">FPS:</span> | ||
<span className="text-white/55"> | ||
{Math.round(frameRate * 1000) / 1000} | ||
</span> | ||
</div> | ||
</div> | ||
<div className="flex flex-row space-x-6"> | ||
<TimelineZoom /> | ||
<Tasks /> | ||
</div> | ||
<MobileBottomBar /> | ||
<DesktopBottomBar /> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.