Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: adjusting design of the perspective switcher

Ilian Sapundshiev4ffe5c288cbc
diff --git a/src/renderer/components/FolderContainer.tsx b/src/renderer/components/FolderContainer.tsx
index 87e57afe2..bdacb6a98 100644
--- a/src/renderer/components/FolderContainer.tsx
+++ b/src/renderer/components/FolderContainer.tsx
@@ -177,7 +177,7 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {
data-tid={perspective.key}
onClick={() => switchPerspective(perspective.id)}
sx={{
- opacity: 0.9,
+ opacity: '0.9',
backgroundColor: theme.palette.background.default,
border: '1px solid ' + theme.palette.divider,
}}
@@ -412,33 +412,30 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {
aria-label="open folder ai chat"
exclusive
>
- <Tooltip
- title={
+ <TsToggleButton
+ value=""
+ tooltip={
readOnlyLocation
? t('core:aiChatForFolderDisabled')
: t('core:aiChatForFolder')
}
+ aria-label="chat-label"
+ data-tid="chatTID"
+ sx={{
+ marginLeft: '5px',
+ // ...(readOnlyLocation
+ // ? {}
+ // : { color: theme.palette.primary.main }),
+ backgroundColor: theme.palette.background.default,
+ border: '1px solid ' + theme.palette.divider,
+ }}
+ onClick={() => {
+ if (readOnlyLocation) return;
+ openEntry(currentDirectoryPath, TabNames.aiTab);
+ }}
>
- <TsToggleButton
- value=""
- aria-label="chat-label"
- data-tid="chatTID"
- sx={{
- marginLeft: '5px',
- ...(readOnlyLocation
- ? {}
- : { color: theme.palette.primary.main }),
- backgroundColor: theme.palette.background.default,
- border: '1px solid ' + theme.palette.divider,
- }}
- onClick={() => {
- if (readOnlyLocation) return;
- openEntry(currentDirectoryPath, TabNames.aiTab);
- }}
- >
- <AIIcon />
- </TsToggleButton>
- </Tooltip>
+ <AIIcon />
+ </TsToggleButton>
</ToggleButtonGroup>
)}
</Box>
diff --git a/src/renderer/components/TsToggleButton.tsx b/src/renderer/components/TsToggleButton.tsx
index bbac79a00..6b467d3d9 100644
--- a/src/renderer/components/TsToggleButton.tsx
+++ b/src/renderer/components/TsToggleButton.tsx
@@ -21,6 +21,7 @@ import TooltipTS from '-/components/Tooltip';
import { isDesktopMode } from '-/reducers/settings';
import { ToggleButton } from '@mui/material';
import { ButtonPropsVariantOverrides } from '@mui/material/Button';
+import { alpha, useTheme } from '@mui/material/styles';
import { ToggleButtonProps } from '@mui/material/ToggleButton';
import { OverridableStringUnion } from '@mui/types';
import { useSelector } from 'react-redux';
@@ -35,6 +36,7 @@ export type TSToggleButtonProps = ToggleButtonProps & {
function TsToggleButton(props: TSToggleButtonProps) {
const { children, sx, tooltip, selected, ...rest } = props;
+ const theme = useTheme();
const desktopMode = useSelector(isDesktopMode);
let button = (
<ToggleButton
@@ -42,12 +44,23 @@ function TsToggleButton(props: TSToggleButtonProps) {
variant="outlined" // text outlined contained
{...rest}
sx={{
+ ...sx,
borderRadius: AppConfig.defaultCSSRadius,
textTransform: 'none', //'capitalize',
- fontSize: 14,
+ fontSize: '14px',
// fontWeight: selected ? 'bold' : 'normal',
fontWeight: 'normal',
- ...sx,
+ '&:hover': {
+ backgroundColor: alpha(theme.palette.background.default, 0.9),
+ },
+ '&.Mui-selected': {
+ // color: theme.palette.secondary.main,
+ backgroundColor: alpha(theme.palette.background.default, 0.9),
+ },
+ '&.Mui-selected:hover': {
+ // color: theme.palette.secondary.main,
+ backgroundColor: alpha(theme.palette.background.default, 0.9),
+ },
}}
>
{children}