Skip to content

Commit bafb30e

Browse files
committed
0.1.1
1 parent 2507df2 commit bafb30e

5 files changed

Lines changed: 180 additions & 66 deletions

File tree

src/components/Header.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,12 @@ export const Header: React.FC = () => {
103103
<div className="flex items-center justify-between h-16">
104104
{/* Logo and Title */}
105105
<div className="flex items-center space-x-3">
106-
<div className="flex items-center justify-center w-10 h-10 bg-blue-600 rounded-lg">
107-
<Star className="w-6 h-6 text-white" />
106+
<div className="flex items-center justify-center w-10 h-10 rounded-lg overflow-hidden">
107+
<img
108+
src="/assets/icon.png"
109+
alt="GitHub Stars Manager"
110+
className="w-10 h-10 object-cover"
111+
/>
108112
</div>
109113
<div>
110114
<h1 className="text-xl font-bold text-gray-900 dark:text-white">

src/components/ReleaseTimeline.tsx

Lines changed: 74 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useMemo } from 'react';
2-
import { ExternalLink, GitBranch, Calendar, Package, Bell, Search, X, RefreshCw, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Eye, EyeOff } from 'lucide-react';
2+
import { ExternalLink, GitBranch, Calendar, Package, Bell, Search, X, RefreshCw, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, Eye, EyeOff, Apple, Monitor, Terminal, Smartphone, Globe, Download } from 'lucide-react';
33
import { Release } from '../types';
44
import { useAppStore } from '../store/useAppStore';
55
import { GitHubApiService } from '../services/githubApi';
@@ -288,15 +288,37 @@ export const ReleaseTimeline: React.FC = () => {
288288
};
289289

290290
const getPlatformIcon = (platform: string) => {
291-
const iconMap: Record<string, string> = {
292-
windows: 'fab fa-windows',
293-
macos: 'fab fa-apple',
294-
linux: 'fab fa-linux',
295-
android: 'fab fa-android',
296-
ios: 'fab fa-apple',
297-
universal: 'fas fa-download'
291+
const platformLower = platform.toLowerCase();
292+
293+
switch (platformLower) {
294+
case 'windows':
295+
return Monitor;
296+
case 'macos':
297+
case 'mac':
298+
case 'ios':
299+
return Apple;
300+
case 'linux':
301+
return Terminal;
302+
case 'android':
303+
return Smartphone;
304+
case 'universal':
305+
default:
306+
return Download;
307+
}
308+
};
309+
310+
const getPlatformDisplayName = (platform: string) => {
311+
const platformLower = platform.toLowerCase();
312+
const nameMap: Record<string, string> = {
313+
windows: 'Windows',
314+
macos: 'macOS',
315+
mac: 'macOS',
316+
linux: 'Linux',
317+
android: 'Android',
318+
ios: 'iOS',
319+
universal: 'Universal'
298320
};
299-
return iconMap[platform] || 'fas fa-download';
321+
return nameMap[platformLower] || platform;
300322
};
301323

302324
const getPlatformColor = (platform: string) => {
@@ -338,9 +360,29 @@ export const ReleaseTimeline: React.FC = () => {
338360
<p className="text-gray-500 dark:text-gray-400 mb-6 max-w-md mx-auto">
339361
{subscribedRepoCount === 0
340362
? t('从仓库页面订阅仓库Release以在此查看更新。', 'Subscribe to repository releases from the Repositories tab to see updates here.')
341-
: t(`您已订阅 ${subscribedRepoCount} 个仓库,但没有找到最近的Release。尝试同步以获取最新更新。`, `You're subscribed to ${subscribedRepoCount} repositories, but no recent releases were found. Try syncing to get the latest updates.`)
363+
: t(`您已订阅 ${subscribedRepoCount} 个仓库,但没有找到最近的Release。点击下方刷新按钮获取最新更新。`, `You're subscribed to ${subscribedRepoCount} repositories, but no recent releases were found. Click the refresh button below to get the latest updates.`)
342364
}
343365
</p>
366+
367+
{/* 刷新按钮 - 在有订阅仓库时显示 */}
368+
{subscribedRepoCount > 0 && (
369+
<div className="mb-6">
370+
<button
371+
onClick={handleRefresh}
372+
disabled={isRefreshing}
373+
className="flex items-center space-x-2 px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed mx-auto"
374+
>
375+
<RefreshCw className={`w-5 h-5 ${isRefreshing ? 'animate-spin' : ''}`} />
376+
<span>{isRefreshing ? t('刷新中...', 'Refreshing...') : t('刷新Release', 'Refresh Releases')}</span>
377+
</button>
378+
{lastRefreshTime && (
379+
<p className="text-sm text-gray-500 dark:text-gray-400 mt-2">
380+
{t('上次刷新:', 'Last refresh:')} {formatDistanceToNow(new Date(lastRefreshTime), { addSuffix: true })}
381+
</p>
382+
)}
383+
</div>
384+
)}
385+
344386
{subscribedRepoCount === 0 && (
345387
<div className="bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 max-w-md mx-auto">
346388
<div className="flex items-center space-x-2 text-blue-700 dark:text-blue-300">
@@ -459,8 +501,8 @@ export const ReleaseTimeline: React.FC = () => {
459501
: 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600'
460502
}`}
461503
>
462-
<i className={`${getPlatformIcon(platform)} w-4 h-4`}></i>
463-
<span className="capitalize">{platform}</span>
504+
{React.createElement(getPlatformIcon(platform), { className: "w-4 h-4" })}
505+
<span className="capitalize">{getPlatformDisplayName(platform)}</span>
464506
</button>
465507
))}
466508
{(searchQuery || selectedPlatforms.length > 0) && (
@@ -646,13 +688,16 @@ export const ReleaseTimeline: React.FC = () => {
646688
}}
647689
>
648690
<div className="flex items-center space-x-1">
649-
{link.platforms.map((platform, pIndex) => (
650-
<i
651-
key={pIndex}
652-
className={`${getPlatformIcon(platform)} w-4 h-4 ${getPlatformColor(platform)}`}
653-
title={platform}
654-
></i>
655-
))}
691+
{link.platforms.map((platform, pIndex) => {
692+
const IconComponent = getPlatformIcon(platform);
693+
return (
694+
<IconComponent
695+
key={pIndex}
696+
className={`w-4 h-4 ${getPlatformColor(platform)}`}
697+
title={getPlatformDisplayName(platform)}
698+
/>
699+
);
700+
})}
656701
</div>
657702
<span className="truncate max-w-32">{link.name}</span>
658703
</a>
@@ -733,13 +778,16 @@ export const ReleaseTimeline: React.FC = () => {
733778
}}
734779
>
735780
<div className="flex items-center space-x-0.5">
736-
{link.platforms.map((platform, pIndex) => (
737-
<i
738-
key={pIndex}
739-
className={`${getPlatformIcon(platform)} w-3 h-3 ${getPlatformColor(platform)}`}
740-
title={platform}
741-
></i>
742-
))}
781+
{link.platforms.map((platform, pIndex) => {
782+
const IconComponent = getPlatformIcon(platform);
783+
return (
784+
<IconComponent
785+
key={pIndex}
786+
className={`w-3 h-3 ${getPlatformColor(platform)}`}
787+
title={getPlatformDisplayName(platform)}
788+
/>
789+
);
790+
})}
743791
</div>
744792
<span className="text-xs text-gray-700 dark:text-gray-300 truncate max-w-16">
745793
{link.name.split('.').pop() || link.name}

src/components/RepositoryCard.tsx

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useRef, useEffect } from 'react';
2-
import { Star, GitFork, Eye, ExternalLink, Calendar, Tag, Bell, BellOff, Bot, Monitor, Smartphone, Globe, Terminal, Package, Edit3, BookOpen } from 'lucide-react';
2+
import { Star, GitFork, Eye, ExternalLink, Calendar, Tag, Bell, BellOff, Bot, Monitor, Smartphone, Globe, Terminal, Package, Edit3, BookOpen, Apple, Zap } from 'lucide-react';
33
import { Repository } from '../types';
44
import { useAppStore, getAllCategories } from '../store/useAppStore';
55
import { GitHubApiService } from '../services/githubApi';
@@ -87,19 +87,46 @@ export const RepositoryCard: React.FC<RepositoryCardProps> = ({
8787
};
8888

8989
const getPlatformIcon = (platform: string) => {
90-
const iconMap: Record<string, string> = {
91-
mac: 'fab fa-apple',
92-
macos: 'fab fa-apple',
93-
windows: 'fab fa-windows',
94-
win: 'fab fa-windows',
95-
linux: 'fab fa-linux',
96-
ios: 'fab fa-apple',
97-
android: 'fab fa-android',
98-
web: 'fas fa-globe',
99-
cli: 'fas fa-terminal',
100-
docker: 'fab fa-docker',
90+
const platformLower = platform.toLowerCase();
91+
92+
switch (platformLower) {
93+
case 'mac':
94+
case 'macos':
95+
case 'ios':
96+
return Apple;
97+
case 'windows':
98+
case 'win':
99+
return Monitor; // 使用 Monitor 代表 Windows
100+
case 'linux':
101+
return Terminal; // 使用 Terminal 代表 Linux
102+
case 'android':
103+
return Smartphone;
104+
case 'web':
105+
return Globe;
106+
case 'cli':
107+
return Terminal;
108+
case 'docker':
109+
return Package;
110+
default:
111+
return Monitor; // 默认使用 Monitor
112+
}
113+
};
114+
115+
const getPlatformDisplayName = (platform: string) => {
116+
const platformLower = platform.toLowerCase();
117+
const nameMap: Record<string, string> = {
118+
mac: 'macOS',
119+
macos: 'macOS',
120+
windows: 'Windows',
121+
win: 'Windows',
122+
linux: 'Linux',
123+
ios: 'iOS',
124+
android: 'Android',
125+
web: 'Web',
126+
cli: 'CLI',
127+
docker: 'Docker',
101128
};
102-
return iconMap[platform.toLowerCase()] || 'fas fa-desktop';
129+
return nameMap[platformLower] || platform;
103130
};
104131

105132
const handleAIAnalyze = async () => {
@@ -407,15 +434,20 @@ export const RepositoryCard: React.FC<RepositoryCardProps> = ({
407434
{language === 'zh' ? '支持平台:' : 'Platforms:'}
408435
</span>
409436
<div className="flex space-x-1">
410-
{repository.ai_platforms.slice(0, 6).map((platform, index) => (
411-
<div
412-
key={index}
413-
className="w-6 h-6 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-400"
414-
title={platform}
415-
>
416-
<i className={`${getPlatformIcon(platform)} text-xs`}></i>
417-
</div>
418-
))}
437+
{repository.ai_platforms.slice(0, 6).map((platform, index) => {
438+
const IconComponent = getPlatformIcon(platform);
439+
const displayName = getPlatformDisplayName(platform);
440+
441+
return (
442+
<div
443+
key={index}
444+
className="w-6 h-6 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors cursor-default"
445+
title={displayName}
446+
>
447+
<IconComponent className="w-3 h-3" />
448+
</div>
449+
);
450+
})}
419451
</div>
420452
</div>
421453
)}

src/components/SearchBar.tsx

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import { Search, Filter, X, SlidersHorizontal, Monitor, Smartphone, Globe, Terminal, Package, CheckCircle, Bell, BellOff } from 'lucide-react';
2+
import { Search, Filter, X, SlidersHorizontal, Monitor, Smartphone, Globe, Terminal, Package, CheckCircle, Bell, BellOff, Apple } from 'lucide-react';
33
import { useAppStore } from '../store/useAppStore';
44
import { AIService } from '../services/aiService';
55

@@ -245,19 +245,46 @@ export const SearchBar: React.FC = () => {
245245
(searchFilters.isSubscribed !== undefined ? 1 : 0);
246246

247247
const getPlatformIcon = (platform: string) => {
248-
const iconMap: Record<string, string> = {
249-
mac: 'fab fa-apple',
250-
macos: 'fab fa-apple',
251-
windows: 'fab fa-windows',
252-
win: 'fab fa-windows',
253-
linux: 'fab fa-linux',
254-
ios: 'fab fa-apple',
255-
android: 'fab fa-android',
256-
web: 'fas fa-globe',
257-
cli: 'fas fa-terminal',
258-
docker: 'fab fa-docker',
248+
const platformLower = platform.toLowerCase();
249+
250+
switch (platformLower) {
251+
case 'mac':
252+
case 'macos':
253+
case 'ios':
254+
return Apple;
255+
case 'windows':
256+
case 'win':
257+
return Monitor;
258+
case 'linux':
259+
return Terminal;
260+
case 'android':
261+
return Smartphone;
262+
case 'web':
263+
return Globe;
264+
case 'cli':
265+
return Terminal;
266+
case 'docker':
267+
return Package;
268+
default:
269+
return Monitor;
270+
}
271+
};
272+
273+
const getPlatformDisplayName = (platform: string) => {
274+
const platformLower = platform.toLowerCase();
275+
const nameMap: Record<string, string> = {
276+
mac: 'macOS',
277+
macos: 'macOS',
278+
windows: 'Windows',
279+
win: 'Windows',
280+
linux: 'Linux',
281+
ios: 'iOS',
282+
android: 'Android',
283+
web: 'Web',
284+
cli: 'CLI',
285+
docker: 'Docker',
259286
};
260-
return iconMap[platform.toLowerCase()] || 'fas fa-desktop';
287+
return nameMap[platformLower] || platform;
261288
};
262289

263290
const t = (zh: string, en: string) => language === 'zh' ? zh : en;
@@ -458,8 +485,8 @@ export const SearchBar: React.FC = () => {
458485
: 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-600'
459486
}`}
460487
>
461-
<i className={`${getPlatformIcon(platform)} w-4 h-4`}></i>
462-
<span>{platform}</span>
488+
{React.createElement(getPlatformIcon(platform), { className: "w-4 h-4" })}
489+
<span>{getPlatformDisplayName(platform)}</span>
463490
</button>
464491
))}
465492
</div>

src/store/useAppStore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,14 @@ export const useAppStore = create<AppState & AppActions>()(
251251
}),
252252
toggleReleaseSubscription: (repoId) => set((state) => {
253253
const newSubscriptions = new Set(state.releaseSubscriptions);
254-
if (newSubscriptions.has(repoId)) {
254+
const wasSubscribed = newSubscriptions.has(repoId);
255+
256+
if (wasSubscribed) {
255257
newSubscriptions.delete(repoId);
256258
} else {
257259
newSubscriptions.add(repoId);
258260
}
261+
259262
return { releaseSubscriptions: newSubscriptions };
260263
}),
261264
markReleaseAsRead: (releaseId) => set((state) => {

0 commit comments

Comments
 (0)