Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
molvqingtai committed Nov 18, 2024
2 parents ebd4e99 + 5255a8b commit ece9597
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 207 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"homepage": "https://github.com/molvqingtai/WebChat",
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@number-flow/react": "^0.3.2",
"@number-flow/react": "^0.3.4",
"@perfsee/jsonr": "^1.13.0",
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-checkbox": "^1.1.2",
Expand Down Expand Up @@ -73,7 +73,7 @@
"date-fns": "^4.1.0",
"framer-motion": "^11.11.17",
"idb-keyval": "^6.2.1",
"lucide-react": "^0.456.0",
"lucide-react": "^0.460.0",
"nanoid": "^5.0.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand All @@ -89,15 +89,15 @@
"rxjs": "^7.8.1",
"sonner": "^1.7.0",
"tailwind-merge": "^2.5.4",
"type-fest": "^4.26.1",
"type-fest": "^4.27.0",
"unstorage": "^1.13.1",
"valibot": "1.0.0-beta.0"
},
"devDependencies": {
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@eslint-react/eslint-plugin": "^1.16.1",
"@eslint/js": "^9.14.0",
"@eslint/js": "^9.15.0",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
Expand All @@ -111,7 +111,7 @@
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"cross-env": "^7.0.3",
"eslint": "^9.14.0",
"eslint": "^9.15.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-tailwindcss": "^3.17.5",
Expand All @@ -131,7 +131,7 @@
"typescript-eslint": "^8.14.0",
"vite-plugin-svgr": "^4.3.0",
"webext-bridge": "^6.0.1",
"wxt": "^0.19.15"
"wxt": "^0.19.16"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --fix --flag unstable_ts_config"
Expand Down
394 changes: 203 additions & 191 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/app/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { defineBackground } from 'wxt/sandbox'
export default defineBackground({
type: 'module',
main() {
browser.action.onClicked.addListener(() => {
browser.runtime.openOptionsPage()
})

const historyNotificationTabs = new Map<string, Tabs.Tab>()
messenger.onMessage(EVENT.OPTIONS_PAGE_OPEN, () => {
browser.runtime.openOptionsPage()
Expand All @@ -18,6 +22,8 @@ export default defineBackground({
return new URL(tab.url!).origin === new URL(sender.tab!.url!).origin
})

console.log('sender', sender)

if (hasActiveSomeSiteTab) return

browser.notifications.create(message.id, {
Expand All @@ -38,7 +44,8 @@ export default defineBackground({
if (fromTab?.id) {
try {
const tab = await browser.tabs.get(fromTab.id)
browser.tabs.update(tab.id, { active: true })
browser.tabs.update(tab.id, { active: true, highlighted: true })
browser.windows.update(tab.windowId!, { focused: true })
} catch {
browser.tabs.create({ url: fromTab.url })
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { createElement } from '@/utils'

export default defineContentScript({
cssInjectionMode: 'ui',
runAt: 'document_end',
runAt: 'document_idle',
matches: ['https://*/*'],
excludeMatches: ['*://localhost/*', '*://127.0.0.1/*', '*://*.csdn.net/*', '*://*.csdn.com/*'],
async main(ctx) {
Expand Down
12 changes: 7 additions & 5 deletions src/app/content/views/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ const Header: FC = () => {
</Avatar>
<div className="grid items-center">
<div className="flex items-center gap-x-1 overflow-hidden">
<h4 className="flex-1 truncate text-sm font-semibold">{site.hostname.replace(/^www\./i, '')}</h4>
<h4 className="flex-1 truncate text-sm font-semibold text-slate-600 dark:text-slate-50">
{site.hostname.replace(/^www\./i, '')}
</h4>
<div className="shrink-0 text-sm">
<div className="flex items-center gap-x-1 text-nowrap text-xs text-slate-500">
<div className="flex items-center gap-x-1 text-nowrap text-xs text-slate-500 dark:text-slate-100">
<div className="flex items-center gap-x-1 pt-px">
<span className="relative flex size-2">
<span
Expand All @@ -94,7 +96,7 @@ const Header: FC = () => {
)}
></span>
</span>
<span className="flex items-center leading-none dark:text-slate-50">
<span className="flex items-center leading-none ">
<span className="py-[0.25em]">ONLINE</span>
</span>
</div>
Expand All @@ -117,7 +119,7 @@ const Header: FC = () => {
<HoverCard>
<HoverCardTrigger asChild>
<Button className=" rounded-md p-0 hover:no-underline" variant="link">
<div className="relative flex items-center gap-x-1 text-nowrap text-xs text-slate-500 hover:after:absolute hover:after:bottom-0 hover:after:left-0 hover:after:h-px hover:after:w-full hover:after:bg-black">
<div className="relative flex items-center gap-x-1 text-nowrap text-xs text-slate-500 hover:after:absolute hover:after:bottom-0 hover:after:left-0 hover:after:h-px hover:after:w-full hover:after:bg-black dark:text-slate-100 dark:hover:after:bg-white">
<div className="flex items-center gap-x-1 pt-px">
<span className="relative flex size-2">
<span
Expand All @@ -133,7 +135,7 @@ const Header: FC = () => {
)}
></span>
</span>
<span className="flex items-center leading-none dark:text-slate-50">
<span className="flex items-center leading-none">
<span className="py-[0.25em]">ONLINE</span>
</span>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/app/content/views/Setup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ const Setup: FC = () => {
useEffect(() => {
const timer = new Timer(
async () => {
await createMessage(await refreshUserInfo())
if (timer.status !== 'stopped') {
await createMessage(await refreshUserInfo())
}
},
{ delay: 2000, immediate: true, limit: mockTextList.length }
)
Expand Down
2 changes: 1 addition & 1 deletion src/app/options/components/ProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultUserInfo: UserInfo = {
themeMode: 'system',
danmakuEnabled: true,
notificationEnabled: true,
notificationType: 'all'
notificationType: 'at'
}

const formSchema = v.object({
Expand Down
3 changes: 2 additions & 1 deletion wxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export default defineConfig({
'32': 'logo.png',
'48': 'logo.png',
'128': 'logo.png'
}
},
action: {}
}
return {
chrome: {
Expand Down

0 comments on commit ece9597

Please sign in to comment.