-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): open app in electron app entry (#8637)
- Loading branch information
Showing
36 changed files
with
886 additions
and
225 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
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
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
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
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
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
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
18 changes: 18 additions & 0 deletions
18
...frontend/core/src/components/affine/setting-modal/general-setting/appearance/links.css.ts
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,18 @@ | ||
import { cssVar } from '@toeverything/theme'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const menu = style({ | ||
background: cssVar('white'), | ||
width: '250px', | ||
maxHeight: '30vh', | ||
overflowY: 'auto', | ||
}); | ||
|
||
export const menuItem = style({ | ||
color: cssVar('textPrimaryColor'), | ||
selectors: { | ||
'&[data-selected=true]': { | ||
color: cssVar('primaryColor'), | ||
}, | ||
}, | ||
}); |
55 changes: 55 additions & 0 deletions
55
...es/frontend/core/src/components/affine/setting-modal/general-setting/appearance/links.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,55 @@ | ||
import { Menu, MenuItem, MenuTrigger } from '@affine/component'; | ||
import { | ||
OpenInAppService, | ||
OpenLinkMode, | ||
} from '@affine/core/modules/open-in-app'; | ||
import { useI18n } from '@affine/i18n'; | ||
import { useLiveData, useService } from '@toeverything/infra'; | ||
import { useMemo } from 'react'; | ||
|
||
import * as styles from './links.css'; | ||
|
||
export const OpenInAppLinksMenu = () => { | ||
const t = useI18n(); | ||
const openInAppService = useService(OpenInAppService); | ||
const currentOpenInAppMode = useLiveData(openInAppService.openLinkMode$); | ||
|
||
const options = useMemo( | ||
() => | ||
Object.values(OpenLinkMode).map(mode => ({ | ||
label: | ||
t.t(`com.affine.setting.appearance.open-in-app.${mode}`) || | ||
`com.affine.setting.appearance.open-in-app.${mode}`, | ||
value: mode, | ||
})), | ||
[t] | ||
); | ||
|
||
return ( | ||
<Menu | ||
items={options.map(option => { | ||
return ( | ||
<MenuItem | ||
key={option.value} | ||
title={option.label} | ||
onSelect={() => openInAppService.setOpenLinkMode(option.value)} | ||
data-selected={currentOpenInAppMode === option.value} | ||
> | ||
{option.label} | ||
</MenuItem> | ||
); | ||
})} | ||
contentOptions={{ | ||
className: styles.menu, | ||
align: 'end', | ||
}} | ||
> | ||
<MenuTrigger | ||
style={{ textTransform: 'capitalize', fontWeight: 600, width: '250px' }} | ||
block={true} | ||
> | ||
{options.find(option => option.value === currentOpenInAppMode)?.label} | ||
</MenuTrigger> | ||
</Menu> | ||
); | ||
}; |
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
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
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
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
Oops, something went wrong.