mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-21 13:53:13 +01:00
v4.2
This commit is contained in:
1 parent
b4266cb7fa
commit
ada11f086e
24 files changed
+2006
-1828
No files matched your search
@@ -174,10 +174,10 @@ func (a *App) Quit() {
|
||||
|
||||
// DownloadMediaRequest represents the request for downloading media (legacy)
|
||||
type DownloadMediaRequest struct {
|
||||
URLs []string `json:"urls"`
|
||||
OutputDir string `json:"output_dir"`
|
||||
Username string `json:"username"`
|
||||
Proxy string `json:"proxy,omitempty"` // Optional proxy URL (e.g., http://proxy:port or socks5://proxy:port)
|
||||
URLs []string `json:"urls"`
|
||||
OutputDir string `json:"output_dir"`
|
||||
Username string `json:"username"`
|
||||
Proxy string `json:"proxy,omitempty"` // Optional proxy URL (e.g., http://proxy:port or socks5://proxy:port)
|
||||
}
|
||||
|
||||
// MediaItemRequest represents a media item with metadata
|
||||
@@ -186,7 +186,7 @@ type MediaItemRequest struct {
|
||||
Date string `json:"date"`
|
||||
TweetID backend.TweetIDString `json:"tweet_id"`
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content,omitempty"` // Tweet text content (for text-only tweets)
|
||||
Content string `json:"content,omitempty"` // Tweet text content (for text-only tweets)
|
||||
OriginalFilename string `json:"original_filename,omitempty"` // Original filename from API
|
||||
AuthorUsername string `json:"author_username,omitempty"` // Username of tweet author (for bookmarks and likes)
|
||||
}
|
||||
@@ -275,23 +275,23 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
outputDir = backend.GetDefaultDownloadPath()
|
||||
}
|
||||
|
||||
// Convert request items to backend items
|
||||
// For bookmarks and likes, use author_username from each item if available
|
||||
items := make([]backend.MediaItem, len(req.Items))
|
||||
for i, item := range req.Items {
|
||||
// Use original filename from API if available, otherwise extract from URL
|
||||
originalFilename := item.OriginalFilename
|
||||
if originalFilename == "" {
|
||||
// Fallback: extract from URL if not provided in API response
|
||||
originalFilename = backend.ExtractOriginalFilename(item.URL)
|
||||
}
|
||||
|
||||
// For bookmarks and likes, use author_username from item, otherwise use req.Username
|
||||
username := req.Username
|
||||
if item.AuthorUsername != "" {
|
||||
username = item.AuthorUsername
|
||||
}
|
||||
|
||||
// Convert request items to backend items
|
||||
// For bookmarks and likes, use author_username from each item if available
|
||||
items := make([]backend.MediaItem, len(req.Items))
|
||||
for i, item := range req.Items {
|
||||
// Use original filename from API if available, otherwise extract from URL
|
||||
originalFilename := item.OriginalFilename
|
||||
if originalFilename == "" {
|
||||
// Fallback: extract from URL if not provided in API response
|
||||
originalFilename = backend.ExtractOriginalFilename(item.URL)
|
||||
}
|
||||
|
||||
// For bookmarks and likes, use author_username from item, otherwise use req.Username
|
||||
username := req.Username
|
||||
if item.AuthorUsername != "" {
|
||||
username = item.AuthorUsername
|
||||
}
|
||||
|
||||
items[i] = backend.MediaItem{
|
||||
URL: item.URL,
|
||||
Date: item.Date,
|
||||
@@ -333,7 +333,7 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
return DownloadMediaResponse{
|
||||
Success: false,
|
||||
Downloaded: downloaded,
|
||||
Skipped: skipped,
|
||||
Skipped: skipped,
|
||||
Failed: failed,
|
||||
Message: err.Error(),
|
||||
}, err
|
||||
@@ -345,7 +345,7 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
return DownloadMediaResponse{
|
||||
Success: true,
|
||||
Downloaded: downloaded,
|
||||
Skipped: skipped,
|
||||
Skipped: skipped,
|
||||
Failed: failed,
|
||||
Message: fmt.Sprintf("Downloaded %d files, %d skipped, %d failed", downloaded, skipped, failed),
|
||||
}, nil
|
||||
@@ -497,6 +497,31 @@ type ImportAccountResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// CheckFolderExists checks if a folder exists for the given username
|
||||
func (a *App) CheckFolderExists(basePath, username string) bool {
|
||||
return backend.CheckFolderExists(basePath, username)
|
||||
}
|
||||
|
||||
// CheckGifsFolderExists checks if a gifs subfolder exists for the given username
|
||||
func (a *App) CheckGifsFolderExists(basePath, username string) bool {
|
||||
return backend.CheckGifsFolderExists(basePath, username)
|
||||
}
|
||||
|
||||
// CheckGifsFolderHasMP4 checks if the gifs folder has any MP4 files to convert
|
||||
func (a *App) CheckGifsFolderHasMP4(basePath, username string) bool {
|
||||
return backend.CheckGifsFolderHasMP4(basePath, username)
|
||||
}
|
||||
|
||||
// GetFolderPath returns the full path for a username folder
|
||||
func (a *App) GetFolderPath(basePath, username string) string {
|
||||
return backend.GetFolderPath(basePath, username)
|
||||
}
|
||||
|
||||
// GetGifsFolderPath returns the full path for a username's gifs folder
|
||||
func (a *App) GetGifsFolderPath(basePath, username string) string {
|
||||
return backend.GetGifsFolderPath(basePath, username)
|
||||
}
|
||||
|
||||
// ImportAccountFromJSON imports account from JSON file (supports both old and new format)
|
||||
func (a *App) ImportAccountFromJSON() (ImportAccountResponse, error) {
|
||||
// Open file dialog
|
||||
|
||||
+28
-6
@@ -220,12 +220,34 @@ func ConvertMP4ToGIF(inputPath, outputPath, quality, resolution string) error {
|
||||
var args []string
|
||||
|
||||
if quality == "fast" {
|
||||
// Fast mode: simple conversion
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
// Fast mode: simple conversion with resolution scaling
|
||||
var scaleFilter string
|
||||
switch resolution {
|
||||
case "high":
|
||||
scaleFilter = "scale=800:-1"
|
||||
case "medium":
|
||||
scaleFilter = "scale=600:-1"
|
||||
case "low":
|
||||
scaleFilter = "scale=400:-1"
|
||||
default: // original - no scaling
|
||||
scaleFilter = ""
|
||||
}
|
||||
|
||||
if scaleFilter != "" {
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-vf", scaleFilter,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
}
|
||||
} else {
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Better mode: optimized palette with dithering
|
||||
|
||||
@@ -2,7 +2,9 @@ package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
@@ -50,3 +52,53 @@ func SelectFolderDialog(ctx context.Context, defaultPath string) (string, error)
|
||||
|
||||
return selectedPath, nil
|
||||
}
|
||||
|
||||
// CheckFolderExists checks if a folder exists at the given path
|
||||
func CheckFolderExists(basePath, username string) bool {
|
||||
folderPath := filepath.Join(basePath, username)
|
||||
info, err := os.Stat(folderPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
// CheckGifsFolderExists checks if a gifs subfolder exists for the given username
|
||||
func CheckGifsFolderExists(basePath, username string) bool {
|
||||
gifsPath := filepath.Join(basePath, username, "gifs")
|
||||
info, err := os.Stat(gifsPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
// CheckGifsFolderHasMP4 checks if the gifs folder has any MP4 files to convert
|
||||
func CheckGifsFolderHasMP4(basePath, username string) bool {
|
||||
gifsPath := filepath.Join(basePath, username, "gifs")
|
||||
|
||||
entries, err := os.ReadDir(gifsPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() {
|
||||
ext := filepath.Ext(entry.Name())
|
||||
if ext == ".mp4" || ext == ".MP4" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetFolderPath returns the full path for a username folder
|
||||
func GetFolderPath(basePath, username string) string {
|
||||
return filepath.Join(basePath, username)
|
||||
}
|
||||
|
||||
// GetGifsFolderPath returns the full path for a username's gifs folder
|
||||
func GetGifsFolderPath(basePath, username string) string {
|
||||
return filepath.Join(basePath, username, "gifs")
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Manrope:wght@200..800&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@300..800&family=Figtree:wght@300..900&family=Geist:wght@100..900&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Inter:wght@300..800&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Manrope:wght@300..800&family=Noto+Sans:wght@100..900&family=Nunito+Sans:opsz,wght@6..12,200..1000&family=Outfit:wght@100..900&family=Plus+Jakarta+Sans:wght@300..800&family=Poppins:wght@300;400;500;600;700;800&family=Public+Sans:ital,wght@0,100..900;1,100..900&family=Raleway:wght@100..900&family=Roboto:wght@300;400;500;700;900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
|
||||
<title>Twitter/X Media Batch Downloader</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+11
-11
@@ -25,31 +25,31 @@
|
||||
"@radix-ui/react-switch": "^1.2.6",
|
||||
"@radix-ui/react-tabs": "^1.1.13",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.559.0",
|
||||
"lucide-react": "^0.561.0",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss": "^4.1.17"
|
||||
"tailwindcss": "^4.1.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@types/node": "^25.0.0",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@types/node": "^25.0.2",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.2",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"eslint-plugin-react-refresh": "^0.4.25",
|
||||
"globals": "^16.5.0",
|
||||
"sharp": "^0.34.5",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.49.0",
|
||||
"vite": "^7.2.7"
|
||||
"typescript-eslint": "^8.50.0",
|
||||
"vite": "^7.3.0"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
9fa5d67c42a33ac8765a4b51d8bc1bb5
|
||||
fac81d3fc08563d82c20da44a49a8efa
|
||||
Generated
+714
-714
File diff suppressed because it is too large.
Load diff
@@ -34,9 +34,13 @@ import { ExtractTimeline, ExtractDateRange, SaveAccountToDBWithStatus, CleanupEx
|
||||
|
||||
const HISTORY_KEY = "twitter_media_fetch_history";
|
||||
const MAX_HISTORY = 10;
|
||||
const CURRENT_VERSION = "4.1";
|
||||
const CURRENT_VERSION = "4.2";
|
||||
const BATCH_SIZE = 200; // Fetch in batches for progressive display and resume
|
||||
|
||||
function formatNumberWithComma(num: number): string {
|
||||
return num.toLocaleString();
|
||||
}
|
||||
|
||||
function App() {
|
||||
const [currentPage, setCurrentPage] = useState<PageType>("main");
|
||||
const [username, setUsername] = useState("");
|
||||
@@ -579,7 +583,7 @@ function App() {
|
||||
// If stopped by user, keep state for resume
|
||||
if (stopFetchRef.current) {
|
||||
logger.info(`Stopped at ${allTimeline.length} items - can resume later`);
|
||||
toast.info(`Stopped at ${allTimeline.length} items`);
|
||||
toast.info(`Stopped at ${formatNumberWithComma(allTimeline.length)} items`);
|
||||
setResumeInfo({ canResume: true, mediaCount: allTimeline.length });
|
||||
} else {
|
||||
// Completed - clear state
|
||||
@@ -655,7 +659,7 @@ function App() {
|
||||
if (partialResponse) {
|
||||
setResult(partialResponse);
|
||||
setResumeInfo({ canResume: true, mediaCount: savedState.timeline.length });
|
||||
toast.info(`Saved ${savedState.timeline.length} items - can resume`);
|
||||
toast.info(`Saved ${formatNumberWithComma(savedState.timeline.length)} items - can resume`);
|
||||
|
||||
// Also save partial data to database for persistence
|
||||
try {
|
||||
@@ -776,7 +780,7 @@ function App() {
|
||||
// Set fetch type to multiple and navigate to home
|
||||
setFetchType("multiple");
|
||||
setCurrentPage("main");
|
||||
toast.success(`Added ${accounts.length} account(s) to multiple fetch`);
|
||||
toast.success(`Added ${formatNumberWithComma(accounts.length)} account(s) to multiple fetch`);
|
||||
};
|
||||
|
||||
// Handle import txt file
|
||||
@@ -812,7 +816,7 @@ function App() {
|
||||
});
|
||||
|
||||
setMultipleAccounts(accounts);
|
||||
toast.success(`Imported ${accounts.length} account(s)`);
|
||||
toast.success(`Imported ${formatNumberWithComma(accounts.length)} account(s)`);
|
||||
} catch (error) {
|
||||
toast.error("Failed to read file");
|
||||
}
|
||||
|
||||
@@ -34,9 +34,10 @@ import {
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { Trash2, FileInput, FileOutput, Pencil, Tag, Shuffle, X, Download, StopCircle, Globe, Lock, Bookmark, Heart, Image, Images, Video, Film, FileText, Filter, AlertCircle, MoreVertical, FileBraces, CloudBackup } from "lucide-react";
|
||||
import { Trash2, FileInput, FileOutput, Pencil, Tag, Shuffle, X, XCircle, Download, StopCircle, Globe, Lock, Bookmark, Heart, Image, Images, Video, Film, FileText, Filter, AlertCircle, MoreVertical, FileBraces, CloudBackup, Search, LayoutGrid, Grid3X3, List, ArrowUpDown, ArrowUp, FolderOpen } from "lucide-react";
|
||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { openExternal } from "@/lib/utils";
|
||||
import {
|
||||
GetAllAccountsFromDB,
|
||||
GetAccountFromDB,
|
||||
@@ -48,6 +49,9 @@ import {
|
||||
GetAllGroups,
|
||||
DownloadMediaWithMetadata,
|
||||
StopDownload,
|
||||
CheckFolderExists,
|
||||
OpenFolder,
|
||||
GetFolderPath,
|
||||
} from "../../wailsjs/go/main/App";
|
||||
import { EventsOn, EventsOff } from "../../wailsjs/runtime/runtime";
|
||||
import { main } from "../../wailsjs/go/models";
|
||||
@@ -105,17 +109,22 @@ interface DatabaseViewProps {
|
||||
onUpdateSelected?: (usernames: string[]) => void;
|
||||
}
|
||||
|
||||
const ITEMS_PER_PAGE = 10;
|
||||
const INITIAL_LOAD_COUNT = 12;
|
||||
const LOAD_MORE_COUNT = 12;
|
||||
|
||||
export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewProps) {
|
||||
const [accounts, setAccounts] = useState<AccountListItem[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [selectedIds, setSelectedIds] = useState<Set<number>>(new Set());
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [visibleCount, setVisibleCount] = useState(INITIAL_LOAD_COUNT);
|
||||
const [showScrollTop, setShowScrollTop] = useState(false);
|
||||
const [groups, setGroups] = useState<GroupInfo[]>([]);
|
||||
const [filterGroup, setFilterGroup] = useState<string>("all");
|
||||
const [filterMediaType, setFilterMediaType] = useState<string>("all");
|
||||
const [viewMode, setViewMode] = useState<"public" | "private">("public");
|
||||
const [accountViewMode, setAccountViewMode] = useState<"public" | "private">("public");
|
||||
const [searchQuery, setSearchQuery] = useState<string>("");
|
||||
const [sortOrder, setSortOrder] = useState<"newest" | "oldest">("newest");
|
||||
const [gridView, setGridView] = useState<"large" | "small" | "list">("list");
|
||||
const [editingAccount, setEditingAccount] = useState<AccountListItem | null>(null);
|
||||
const [editGroupName, setEditGroupName] = useState("");
|
||||
const [editGroupColor, setEditGroupColor] = useState("");
|
||||
@@ -127,6 +136,32 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
const [bulkDownloadCurrent, setBulkDownloadCurrent] = useState(0);
|
||||
const [bulkDownloadTotal, setBulkDownloadTotal] = useState(0);
|
||||
const stopBulkDownloadRef = useRef(false);
|
||||
const loadMoreRef = useRef<HTMLDivElement>(null);
|
||||
const [folderExistence, setFolderExistence] = useState<Map<number, boolean>>(new Map());
|
||||
|
||||
// Check folder existence for all accounts
|
||||
const checkFolderExistence = async (accountsList: AccountListItem[]) => {
|
||||
const settings = getSettings();
|
||||
const basePath = settings.downloadPath;
|
||||
if (!basePath) return;
|
||||
|
||||
const folderMap = new Map<number, boolean>();
|
||||
|
||||
for (const account of accountsList) {
|
||||
// For bookmarks/likes, check special folder names
|
||||
let folderName = account.username;
|
||||
if (account.username === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (account.username === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
|
||||
const exists = await CheckFolderExists(basePath, folderName);
|
||||
folderMap.set(account.id, exists);
|
||||
}
|
||||
|
||||
setFolderExistence(folderMap);
|
||||
};
|
||||
|
||||
const loadAccounts = async () => {
|
||||
setLoading(true);
|
||||
@@ -137,6 +172,10 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
if (groupsData) {
|
||||
setGroups(groupsData.map((g) => ({ name: g.name || "", color: g.color || "" })));
|
||||
}
|
||||
// Check folder existence for all accounts
|
||||
if (data && data.length > 0) {
|
||||
checkFolderExistence(data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to load accounts:", error);
|
||||
toast.error("Failed to load accounts");
|
||||
@@ -149,6 +188,22 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
loadAccounts();
|
||||
}, []);
|
||||
|
||||
// Reset visible count when grid view or filters change
|
||||
useEffect(() => {
|
||||
setVisibleCount(INITIAL_LOAD_COUNT);
|
||||
}, [gridView, searchQuery, filterGroup, filterMediaType, accountViewMode, sortOrder]);
|
||||
|
||||
// Listen for scroll to show/hide scroll-to-top button
|
||||
// Listen for scroll to show/hide scroll-to-top button
|
||||
useEffect(() => {
|
||||
const handleScroll = () => {
|
||||
setShowScrollTop(window.scrollY > 300);
|
||||
};
|
||||
window.addEventListener("scroll", handleScroll);
|
||||
return () => window.removeEventListener("scroll", handleScroll);
|
||||
}, []);
|
||||
|
||||
// Intersection Observer for lazy loading
|
||||
// Listen for download progress events
|
||||
useEffect(() => {
|
||||
const unsubscribe = EventsOn("download-progress", (progress: DownloadProgress) => {
|
||||
@@ -160,6 +215,10 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
};
|
||||
}, []);
|
||||
|
||||
const scrollToTop = () => {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
};
|
||||
|
||||
// Separate accounts into public and private
|
||||
const isPrivateAccount = (username: string) =>
|
||||
username === "bookmarks" || username === "likes";
|
||||
@@ -167,26 +226,61 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
const publicAccounts = accounts.filter((acc) => !isPrivateAccount(acc.username));
|
||||
const privateAccounts = accounts.filter((acc) => isPrivateAccount(acc.username));
|
||||
|
||||
const baseAccounts = viewMode === "public" ? publicAccounts : privateAccounts;
|
||||
const baseAccounts = accountViewMode === "public" ? publicAccounts : privateAccounts;
|
||||
|
||||
const filteredAccounts = baseAccounts.filter((acc) => {
|
||||
// Filter by group
|
||||
if (filterGroup !== "all") {
|
||||
if (filterGroup === "ungrouped" && acc.group_name) return false;
|
||||
if (filterGroup !== "ungrouped" && acc.group_name !== filterGroup) return false;
|
||||
}
|
||||
// Filter by media type
|
||||
if (filterMediaType !== "all") {
|
||||
const accMediaType = acc.media_type || "all";
|
||||
// "all-media" in filter matches "all" in database (fetched with All Media option)
|
||||
if (filterMediaType === "all-media") {
|
||||
if (accMediaType !== "all") return false;
|
||||
} else {
|
||||
if (accMediaType !== filterMediaType) return false;
|
||||
const filteredAccounts = baseAccounts
|
||||
.filter((acc) => {
|
||||
// Filter by search query
|
||||
if (searchQuery) {
|
||||
const query = searchQuery.toLowerCase();
|
||||
const matchesUsername = acc.username.toLowerCase().includes(query);
|
||||
const matchesName = acc.name.toLowerCase().includes(query);
|
||||
if (!matchesUsername && !matchesName) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
// Filter by group
|
||||
if (filterGroup !== "all") {
|
||||
if (filterGroup === "ungrouped" && acc.group_name) return false;
|
||||
if (filterGroup !== "ungrouped" && acc.group_name !== filterGroup) return false;
|
||||
}
|
||||
// Filter by media type
|
||||
if (filterMediaType !== "all") {
|
||||
const accMediaType = acc.media_type || "all";
|
||||
// "all-media" in filter matches "all" in database (fetched with All Media option)
|
||||
if (filterMediaType === "all-media") {
|
||||
if (accMediaType !== "all") return false;
|
||||
} else {
|
||||
if (accMediaType !== filterMediaType) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
// Sort by last_fetched date
|
||||
const dateA = new Date(a.last_fetched).getTime();
|
||||
const dateB = new Date(b.last_fetched).getTime();
|
||||
return sortOrder === "newest" ? dateB - dateA : dateA - dateB;
|
||||
});
|
||||
|
||||
// Intersection Observer for lazy loading
|
||||
useEffect(() => {
|
||||
const currentRef = loadMoreRef.current;
|
||||
if (!currentRef) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (entries[0].isIntersecting) {
|
||||
setVisibleCount((prev) => prev + LOAD_MORE_COUNT);
|
||||
}
|
||||
},
|
||||
{ threshold: 0.1, rootMargin: "100px" }
|
||||
);
|
||||
|
||||
observer.observe(currentRef);
|
||||
|
||||
return () => {
|
||||
observer.unobserve(currentRef);
|
||||
};
|
||||
}, [filteredAccounts.length, visibleCount, loading]);
|
||||
|
||||
const handleEditGroup = (account: AccountListItem) => {
|
||||
setEditingAccount(account);
|
||||
@@ -225,6 +319,22 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenFolder = async (username: string) => {
|
||||
const settings = getSettings();
|
||||
let folderName = username;
|
||||
if (username === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (username === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
const folderPath = await GetFolderPath(settings.downloadPath, folderName);
|
||||
try {
|
||||
await OpenFolder(folderPath);
|
||||
} catch (error) {
|
||||
toast.error("Failed to open folder");
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = async (id: number, username: string) => {
|
||||
try {
|
||||
const responseJSON = await GetAccountFromDB(id);
|
||||
@@ -485,7 +595,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
|
||||
try {
|
||||
await ExportAccountsTXT(idsToExport, outputDir);
|
||||
toast.success(`Exported ${idsToExport.length} account(s) to ${outputDir}\\twitterxmediabatchdownloader_backups\\twitterxmediabatchdownloader_multiple.txt`);
|
||||
toast.success(`Exported ${formatNumberWithComma(idsToExport.length)} account(s) to ${outputDir}\\twitterxmediabatchdownloader_backups\\twitterxmediabatchdownloader_multiple.txt`);
|
||||
} catch (error) {
|
||||
toast.error("Failed to export");
|
||||
}
|
||||
@@ -627,27 +737,27 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
<div className="flex gap-0.5 p-0.5 bg-muted rounded-lg">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setViewMode("public")}
|
||||
onClick={() => setAccountViewMode("public")}
|
||||
className={`flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium transition-all ${
|
||||
viewMode === "public"
|
||||
accountViewMode === "public"
|
||||
? "bg-background text-foreground shadow-sm"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
<Globe className="h-3 w-3" />
|
||||
Public ({publicAccounts.length})
|
||||
Public ({formatNumberWithComma(publicAccounts.length)})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setViewMode("private")}
|
||||
onClick={() => setAccountViewMode("private")}
|
||||
className={`flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium transition-all ${
|
||||
viewMode === "private"
|
||||
accountViewMode === "private"
|
||||
? "bg-background text-foreground shadow-sm"
|
||||
: "text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
>
|
||||
<Lock className="h-3 w-3" />
|
||||
Private ({privateAccounts.length})
|
||||
Private ({formatNumberWithComma(privateAccounts.length)})
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -669,7 +779,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Export Selected ({selectedIds.size})</TooltipContent>
|
||||
<TooltipContent>Export Selected ({formatNumberWithComma(selectedIds.size)})</TooltipContent>
|
||||
</Tooltip>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={handleExportJSON}>
|
||||
@@ -707,7 +817,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
|
||||
if (onUpdateSelected) {
|
||||
onUpdateSelected(usernames);
|
||||
toast.success(`Added ${usernames.length} account(s) to multiple fetch`);
|
||||
toast.success(`Added ${formatNumberWithComma(usernames.length)} account(s) to multiple fetch`);
|
||||
}
|
||||
}}
|
||||
disabled={selectedIds.size === 0 || hasPrivateAccountSelected()}
|
||||
@@ -715,7 +825,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
<CloudBackup className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Update Selected ({selectedIds.size})</TooltipContent>
|
||||
<TooltipContent>Update Selected ({formatNumberWithComma(selectedIds.size)})</TooltipContent>
|
||||
</Tooltip>
|
||||
{isBulkDownloading ? (
|
||||
<Tooltip>
|
||||
@@ -733,19 +843,19 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
<Download className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Download Selected ({selectedIds.size})</TooltipContent>
|
||||
<TooltipContent>Download Selected ({formatNumberWithComma(selectedIds.size)})</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Dialog open={clearAllDialogOpen} onOpenChange={setClearAllDialogOpen}>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant="destructive" size="icon" disabled={baseAccounts.length === 0}>
|
||||
<Button variant="destructive" size="icon" disabled={selectedIds.size === 0}>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Clear All {viewMode === "public" ? "Public" : "Private"}</TooltipContent>
|
||||
<TooltipContent>Delete Selected ({formatNumberWithComma(selectedIds.size)})</TooltipContent>
|
||||
</Tooltip>
|
||||
<DialogContent className="[&>button]:hidden">
|
||||
<div className="absolute right-4 top-4">
|
||||
@@ -759,9 +869,9 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
</Button>
|
||||
</div>
|
||||
<DialogHeader>
|
||||
<DialogTitle>Clear All {viewMode === "public" ? "Public" : "Private"} Accounts?</DialogTitle>
|
||||
<DialogTitle>Delete {formatNumberWithComma(selectedIds.size)} Selected Account{selectedIds.size !== 1 ? 's' : ''}?</DialogTitle>
|
||||
<DialogDescription>
|
||||
This will permanently delete all {formatNumberWithComma(baseAccounts.length)} {viewMode === "public" ? "public" : "private"} saved accounts. This action cannot be undone.
|
||||
This will permanently delete the selected account{selectedIds.size !== 1 ? 's' : ''}. This action cannot be undone.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter>
|
||||
@@ -769,20 +879,20 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
variant="destructive"
|
||||
onClick={async () => {
|
||||
try {
|
||||
// Delete only accounts matching the current view mode
|
||||
const accountsToDelete = baseAccounts.map((acc) => acc.id);
|
||||
for (const id of accountsToDelete) {
|
||||
const idsToDelete = Array.from(selectedIds);
|
||||
for (const id of idsToDelete) {
|
||||
await DeleteAccountFromDB(id);
|
||||
}
|
||||
toast.success(`All ${viewMode === "public" ? "public" : "private"} accounts deleted`);
|
||||
toast.success(`Deleted ${formatNumberWithComma(idsToDelete.length)} account${idsToDelete.length !== 1 ? 's' : ''}`);
|
||||
setClearAllDialogOpen(false);
|
||||
setSelectedIds(new Set());
|
||||
loadAccounts();
|
||||
} catch (error) {
|
||||
toast.error("Failed to clear accounts");
|
||||
toast.error("Failed to delete accounts");
|
||||
}
|
||||
}}
|
||||
>
|
||||
Delete All {viewMode === "public" ? "Public" : "Private"}
|
||||
Delete {formatNumberWithComma(selectedIds.size)} Account{selectedIds.size !== 1 ? 's' : ''}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
@@ -798,8 +908,8 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
{/* Filter and Select All */}
|
||||
<div className="flex items-center gap-4 px-4 py-2">
|
||||
{/* Row 1: Select All + Search Bar (Search only for public) */}
|
||||
<div className="flex items-center gap-4 py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
checked={selectedIds.size === filteredAccounts.length && filteredAccounts.length > 0}
|
||||
@@ -809,7 +919,47 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
Select all {selectedIds.size > 0 && `(${formatNumberWithComma(selectedIds.size)} selected)`}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex-1" />
|
||||
|
||||
{/* Search Bar - Only show for public accounts */}
|
||||
{accountViewMode === "public" && (
|
||||
<div className="relative flex-1">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search..."
|
||||
value={searchQuery}
|
||||
onChange={(e) => {
|
||||
setSearchQuery(e.target.value);
|
||||
}}
|
||||
className="pl-9 h-9"
|
||||
/>
|
||||
{searchQuery && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setSearchQuery("");
|
||||
}}
|
||||
className="absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
<XCircle className="h-4 w-4" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Row 2: Sort, Filters, View Toggle */}
|
||||
<div className="flex items-center gap-2 pb-2">
|
||||
{/* Sort Order */}
|
||||
<Select value={sortOrder} onValueChange={(v) => setSortOrder(v as "newest" | "oldest")}>
|
||||
<SelectTrigger className="w-auto">
|
||||
<ArrowUpDown className="h-4 w-4 mr-2" />
|
||||
<SelectValue placeholder="Sort" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="newest">Newest</SelectItem>
|
||||
<SelectItem value="oldest">Oldest</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
{/* Media Type Filter */}
|
||||
<Select value={filterMediaType} onValueChange={setFilterMediaType}>
|
||||
@@ -830,32 +980,32 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
<SelectItem value="image">
|
||||
<span className="flex items-center gap-2">
|
||||
<Image className="h-4 w-4 text-blue-500" />
|
||||
Images Only
|
||||
Images
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="video">
|
||||
<span className="flex items-center gap-2">
|
||||
<Video className="h-4 w-4 text-purple-500" />
|
||||
Videos Only
|
||||
Videos
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="gif">
|
||||
<span className="flex items-center gap-2">
|
||||
<Film className="h-4 w-4 text-green-500" />
|
||||
GIFs Only
|
||||
GIFs
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="text">
|
||||
<span className="flex items-center gap-2">
|
||||
<FileText className="h-4 w-4 text-orange-500" />
|
||||
Text Only
|
||||
Text
|
||||
</span>
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
{/* Group Filter */}
|
||||
<Select value={filterGroup} onValueChange={setFilterGroup}>
|
||||
<Select value={filterGroup} onValueChange={setFilterGroup} disabled={groups.length === 0}>
|
||||
<SelectTrigger className="w-auto">
|
||||
<Tag className="h-4 w-4 mr-2" />
|
||||
<SelectValue placeholder="Filter by group" />
|
||||
@@ -876,6 +1026,36 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<div className="flex-1" />
|
||||
|
||||
{/* Grid View Toggle */}
|
||||
<div className="flex items-center border rounded-md">
|
||||
<Button
|
||||
variant={gridView === "large" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-9 w-9 rounded-r-none"
|
||||
onClick={() => setGridView("large")}
|
||||
>
|
||||
<LayoutGrid className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant={gridView === "small" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-9 w-9 rounded-none border-x"
|
||||
onClick={() => setGridView("small")}
|
||||
>
|
||||
<Grid3X3 className="h-4 w-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant={gridView === "list" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-9 w-9 rounded-l-none"
|
||||
onClick={() => setGridView("list")}
|
||||
>
|
||||
<List className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bulk Download Progress */}
|
||||
@@ -891,8 +1071,333 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
</div>
|
||||
)}
|
||||
|
||||
{filteredAccounts
|
||||
.slice((currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE)
|
||||
{/* Grid View: Large */}
|
||||
{gridView === "large" && (
|
||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4">
|
||||
{filteredAccounts
|
||||
.slice(0, visibleCount)
|
||||
.map((account) => (
|
||||
<div
|
||||
key={account.id}
|
||||
className={`relative rounded-lg border transition-colors p-4 ${
|
||||
selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"
|
||||
}`}
|
||||
>
|
||||
{/* Checkbox - Top Left */}
|
||||
<Checkbox
|
||||
checked={selectedIds.has(account.id)}
|
||||
onCheckedChange={() => toggleSelect(account.id)}
|
||||
className="absolute top-2 left-2 z-10"
|
||||
/>
|
||||
{/* Media Type Badge - Top Right */}
|
||||
<div className="absolute top-2 right-2 z-10 flex gap-1">
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className={cn(
|
||||
"text-xs flex items-center gap-1",
|
||||
account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400",
|
||||
account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400",
|
||||
account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400",
|
||||
account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400",
|
||||
(!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400"
|
||||
)}
|
||||
>
|
||||
{account.media_type === "text" ? <FileText className="h-3 w-3" /> :
|
||||
account.media_type === "image" ? <Image className="h-3 w-3" /> :
|
||||
account.media_type === "video" ? <Video className="h-3 w-3" /> :
|
||||
account.media_type === "gif" ? <Film className="h-3 w-3" /> :
|
||||
<Images className="h-3 w-3" />}
|
||||
</Badge>
|
||||
{!account.completed && (
|
||||
<Badge variant="secondary" className="text-xs bg-yellow-500/20 text-yellow-600 dark:text-yellow-400">
|
||||
<AlertCircle className="h-3 w-3" />
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col items-center text-center gap-3 pt-4">
|
||||
{isPrivateAccount(account.username) ? (
|
||||
<div
|
||||
className="w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center cursor-pointer hover:bg-primary/20 transition-colors"
|
||||
onClick={() => handleView(account.id, account.username)}
|
||||
>
|
||||
{account.username === "bookmarks" ? (
|
||||
<Bookmark className="h-10 w-10 text-primary" />
|
||||
) : (
|
||||
<Heart className="h-10 w-10 text-primary" />
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<img
|
||||
src={account.profile_image}
|
||||
alt={account.name}
|
||||
className="w-20 h-20 rounded-full cursor-pointer hover:opacity-80 transition-opacity"
|
||||
onClick={() => handleView(account.id, account.username)}
|
||||
/>
|
||||
)}
|
||||
<div className="w-full min-w-0">
|
||||
<div className="font-medium truncate">{account.name}</div>
|
||||
{!isPrivateAccount(account.username) && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openExternal(`https://x.com/${account.username}`)}
|
||||
className="text-sm text-muted-foreground hover:text-primary hover:underline"
|
||||
>
|
||||
@{account.username}
|
||||
</button>
|
||||
)}
|
||||
<div className="text-sm text-muted-foreground mt-1">
|
||||
{formatNumberWithComma(account.total_media)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-1">
|
||||
{downloadingAccountId === account.id ? (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={handleStopDownload}
|
||||
>
|
||||
<StopCircle className="h-4 w-4 text-destructive" />
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
variant="default"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() => handleDownload(account.id, account.username)}
|
||||
disabled={isDownloading}
|
||||
>
|
||||
<Download className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-8 w-8"
|
||||
onClick={() => handleOpenFolder(account.username)}
|
||||
disabled={!folderExistence.get(account.id)}
|
||||
>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
</Button>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" size="icon" className="h-8 w-8">
|
||||
<MoreVertical className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => handleEditGroup(account)}>
|
||||
<Pencil className="h-4 w-4 mr-2" />
|
||||
Edit Group
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={async () => {
|
||||
const settings = getSettings();
|
||||
const outputDir = settings.downloadPath || "";
|
||||
try {
|
||||
await ExportAccountJSON(account.id, outputDir);
|
||||
toast.success(`Exported @${account.username}`);
|
||||
} catch (error) {
|
||||
toast.error("Failed to export");
|
||||
}
|
||||
}}
|
||||
>
|
||||
<FileOutput className="h-4 w-4 mr-2" />
|
||||
Export JSON
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleDelete(account.id, account.username)}
|
||||
className="text-destructive focus:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-2" />
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
{/* Progress bar */}
|
||||
{downloadingAccountId === account.id && downloadProgress && (
|
||||
<div className="mt-3 space-y-1">
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-muted-foreground">
|
||||
{downloadProgress.current}/{downloadProgress.total}
|
||||
</span>
|
||||
<span className="font-medium">{downloadProgress.percent}%</span>
|
||||
</div>
|
||||
<Progress value={downloadProgress.percent} className="h-1.5" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Grid View: Small */}
|
||||
{gridView === "small" && (
|
||||
<div className="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-3">
|
||||
{filteredAccounts
|
||||
.slice(0, visibleCount)
|
||||
.map((account) => (
|
||||
<div
|
||||
key={account.id}
|
||||
className={`relative rounded-lg border transition-colors p-3 ${
|
||||
selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"
|
||||
}`}
|
||||
>
|
||||
{/* Checkbox - Top Left */}
|
||||
<Checkbox
|
||||
checked={selectedIds.has(account.id)}
|
||||
onCheckedChange={() => toggleSelect(account.id)}
|
||||
className="absolute top-1.5 left-1.5 z-10"
|
||||
/>
|
||||
{/* Media Type Badge & Incomplete - Top Right */}
|
||||
<div className="absolute top-1.5 right-1.5 z-10 flex gap-1">
|
||||
<Badge
|
||||
variant="secondary"
|
||||
className={cn(
|
||||
"text-xs p-1",
|
||||
account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400",
|
||||
account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400",
|
||||
account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400",
|
||||
account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400",
|
||||
(!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400"
|
||||
)}
|
||||
>
|
||||
{account.media_type === "text" ? <FileText className="h-3 w-3" /> :
|
||||
account.media_type === "image" ? <Image className="h-3 w-3" /> :
|
||||
account.media_type === "video" ? <Video className="h-3 w-3" /> :
|
||||
account.media_type === "gif" ? <Film className="h-3 w-3" /> :
|
||||
<Images className="h-3 w-3" />}
|
||||
</Badge>
|
||||
{!account.completed && (
|
||||
<Badge variant="secondary" className="text-xs p-1 bg-yellow-500/20 text-yellow-600 dark:text-yellow-400">
|
||||
<AlertCircle className="h-3 w-3" />
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col items-center text-center gap-2 pt-4">
|
||||
{isPrivateAccount(account.username) ? (
|
||||
<div
|
||||
className="w-14 h-14 rounded-full bg-primary/10 flex items-center justify-center cursor-pointer hover:bg-primary/20 transition-colors"
|
||||
onClick={() => handleView(account.id, account.username)}
|
||||
>
|
||||
{account.username === "bookmarks" ? (
|
||||
<Bookmark className="h-7 w-7 text-primary" />
|
||||
) : (
|
||||
<Heart className="h-7 w-7 text-primary" />
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<img
|
||||
src={account.profile_image}
|
||||
alt={account.name}
|
||||
className="w-14 h-14 rounded-full cursor-pointer hover:opacity-80 transition-opacity"
|
||||
onClick={() => handleView(account.id, account.username)}
|
||||
/>
|
||||
)}
|
||||
<div className="w-full min-w-0">
|
||||
<div className="text-xs font-medium truncate">{account.name}</div>
|
||||
{!isPrivateAccount(account.username) && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openExternal(`https://x.com/${account.username}`)}
|
||||
className="text-xs text-muted-foreground hover:text-primary hover:underline truncate block w-full"
|
||||
>
|
||||
@{account.username}
|
||||
</button>
|
||||
)}
|
||||
<div className="text-xs text-muted-foreground">
|
||||
{formatNumberWithComma(account.total_media)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-1">
|
||||
{downloadingAccountId === account.id ? (
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-7 w-7"
|
||||
onClick={handleStopDownload}
|
||||
>
|
||||
<StopCircle className="h-3 w-3 text-destructive" />
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
variant="default"
|
||||
size="icon"
|
||||
className="h-7 w-7"
|
||||
onClick={() => handleDownload(account.id, account.username)}
|
||||
disabled={isDownloading}
|
||||
>
|
||||
<Download className="h-3 w-3" />
|
||||
</Button>
|
||||
)}
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
className="h-7 w-7"
|
||||
onClick={() => handleOpenFolder(account.username)}
|
||||
disabled={!folderExistence.get(account.id)}
|
||||
>
|
||||
<FolderOpen className="h-3 w-3" />
|
||||
</Button>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" size="icon" className="h-7 w-7">
|
||||
<MoreVertical className="h-3 w-3" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem onClick={() => handleEditGroup(account)}>
|
||||
<Pencil className="h-4 w-4 mr-2" />
|
||||
Edit Group
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={async () => {
|
||||
const settings = getSettings();
|
||||
const outputDir = settings.downloadPath || "";
|
||||
try {
|
||||
await ExportAccountJSON(account.id, outputDir);
|
||||
toast.success(`Exported @${account.username}`);
|
||||
} catch (error) {
|
||||
toast.error("Failed to export");
|
||||
}
|
||||
}}
|
||||
>
|
||||
<FileOutput className="h-4 w-4 mr-2" />
|
||||
Export JSON
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleDelete(account.id, account.username)}
|
||||
className="text-destructive focus:text-destructive"
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-2" />
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
{/* Progress bar */}
|
||||
{downloadingAccountId === account.id && downloadProgress && (
|
||||
<div className="mt-2 space-y-1">
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-muted-foreground">
|
||||
{downloadProgress.current}/{downloadProgress.total}
|
||||
</span>
|
||||
<span className="font-medium">{downloadProgress.percent}%</span>
|
||||
</div>
|
||||
<Progress value={downloadProgress.percent} className="h-1" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* List View */}
|
||||
{gridView === "list" && filteredAccounts
|
||||
.slice(0, visibleCount)
|
||||
.map((account, index) => (
|
||||
<div
|
||||
key={account.id}
|
||||
@@ -906,7 +1411,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
onCheckedChange={() => toggleSelect(account.id)}
|
||||
/>
|
||||
<span className="text-sm text-muted-foreground w-8 text-center shrink-0">
|
||||
{(currentPage - 1) * ITEMS_PER_PAGE + index + 1}
|
||||
{index + 1}
|
||||
</span>
|
||||
{isPrivateAccount(account.username) ? (
|
||||
<div
|
||||
@@ -943,7 +1448,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
(!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400"
|
||||
)}
|
||||
>
|
||||
{account.media_type === "text" ? <><FileText className="h-3 w-3" /> Text Only</> :
|
||||
{account.media_type === "text" ? <><FileText className="h-3 w-3" /> Text</> :
|
||||
account.media_type === "image" ? <><Image className="h-3 w-3" /> Images</> :
|
||||
account.media_type === "video" ? <><Video className="h-3 w-3" /> Videos</> :
|
||||
account.media_type === "gif" ? <><Film className="h-3 w-3" /> GIFs</> :
|
||||
@@ -969,7 +1474,13 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
)}
|
||||
</div>
|
||||
{!isPrivateAccount(account.username) && (
|
||||
<div className="text-sm text-muted-foreground">@{account.username}</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => openExternal(`https://x.com/${account.username}`)}
|
||||
className="text-sm text-muted-foreground hover:text-primary hover:underline"
|
||||
>
|
||||
@{account.username}
|
||||
</button>
|
||||
)}
|
||||
<div className="text-sm text-muted-foreground">
|
||||
{account.last_fetched} {getRelativeTime(account.last_fetched)}
|
||||
@@ -1008,6 +1519,19 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
<TooltipContent>Download All Media</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="icon"
|
||||
onClick={() => handleOpenFolder(account.username)}
|
||||
disabled={!folderExistence.get(account.id)}
|
||||
>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Open Folder</TooltipContent>
|
||||
</Tooltip>
|
||||
<DropdownMenu>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
@@ -1094,33 +1618,28 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
</div>
|
||||
))}
|
||||
|
||||
{/* Pagination */}
|
||||
{filteredAccounts.length > ITEMS_PER_PAGE && (
|
||||
<div className="flex items-center justify-center gap-2 pt-4">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setCurrentPage((p) => Math.max(1, p - 1))}
|
||||
disabled={currentPage === 1}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground px-4">
|
||||
Page {currentPage} of {Math.ceil(filteredAccounts.length / ITEMS_PER_PAGE)}
|
||||
</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setCurrentPage((p) => Math.min(Math.ceil(filteredAccounts.length / ITEMS_PER_PAGE), p + 1))}
|
||||
disabled={currentPage === Math.ceil(filteredAccounts.length / ITEMS_PER_PAGE)}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
{/* Load More Trigger (invisible) */}
|
||||
<div
|
||||
ref={loadMoreRef}
|
||||
className={`h-4 ${visibleCount >= filteredAccounts.length ? 'hidden' : ''}`}
|
||||
/>
|
||||
|
||||
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Scroll to Top Button */}
|
||||
{showScrollTop && (
|
||||
<Button
|
||||
variant="default"
|
||||
size="icon"
|
||||
className="fixed bottom-6 left-1/2 -translate-x-1/2 h-9 w-9 rounded-full shadow-lg z-30"
|
||||
onClick={scrollToTop}
|
||||
>
|
||||
<ArrowUp className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{/* Edit Group Dialog */}
|
||||
<Dialog open={!!editingAccount} onOpenChange={(open) => !open && setEditingAccount(null)}>
|
||||
<DialogContent className="[&>button]:hidden">
|
||||
|
||||
@@ -51,7 +51,7 @@ import { logger } from "@/lib/logger";
|
||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { openExternal } from "@/lib/utils";
|
||||
import { DownloadMediaWithMetadata, OpenFolder, IsFFmpegInstalled, ConvertGIFs, StopDownload } from "../../wailsjs/go/main/App";
|
||||
import { DownloadMediaWithMetadata, OpenFolder, IsFFmpegInstalled, ConvertGIFs, StopDownload, CheckFolderExists, CheckGifsFolderHasMP4 } from "../../wailsjs/go/main/App";
|
||||
import { EventsOn, EventsOff } from "../../wailsjs/runtime/runtime";
|
||||
import { main } from "../../wailsjs/go/models";
|
||||
|
||||
@@ -231,9 +231,10 @@ export function MediaList({
|
||||
const [downloadProgress, setDownloadProgress] = useState<DownloadProgress | null>(null);
|
||||
const [hasDownloaded, setHasDownloaded] = useState(false);
|
||||
const [isConverting, setIsConverting] = useState(false);
|
||||
const [hasGifs, setHasGifs] = useState(false);
|
||||
const [ffmpegInstalled, setFfmpegInstalled] = useState(false);
|
||||
const [showScrollTop, setShowScrollTop] = useState(false);
|
||||
const [folderExists, setFolderExists] = useState(false);
|
||||
const [gifsFolderHasMP4, setGifsFolderHasMP4] = useState(false);
|
||||
const [previewIndex, setPreviewIndex] = useState<number | null>(null);
|
||||
// Download status tracking per item (by tweet_id + index for uniqueness)
|
||||
const [downloadedItems, setDownloadedItems] = useState<Set<string>>(new Set());
|
||||
@@ -290,6 +291,40 @@ export function MediaList({
|
||||
setVisibleCount(10);
|
||||
}, [filteredTimeline.length]);
|
||||
|
||||
// Check folder existence and FFmpeg installation
|
||||
useEffect(() => {
|
||||
const checkFoldersAndFFmpeg = async () => {
|
||||
const settings = getSettings();
|
||||
const basePath = settings.downloadPath;
|
||||
|
||||
// Check FFmpeg installation
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
|
||||
if (!basePath || !accountInfo.name) return;
|
||||
|
||||
// For bookmarks/likes, check special folder names
|
||||
let folderName = accountInfo.name;
|
||||
if (accountInfo.nick === "My Bookmarks" || accountInfo.name === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (accountInfo.nick === "My Likes" || accountInfo.name === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
|
||||
const exists = await CheckFolderExists(basePath, folderName);
|
||||
setFolderExists(exists);
|
||||
|
||||
if (exists) {
|
||||
const hasMP4 = await CheckGifsFolderHasMP4(basePath, folderName);
|
||||
setGifsFolderHasMP4(hasMP4);
|
||||
} else {
|
||||
setGifsFolderHasMP4(false);
|
||||
}
|
||||
};
|
||||
|
||||
checkFoldersAndFFmpeg();
|
||||
}, [accountInfo.name, accountInfo.nick, hasDownloaded]);
|
||||
|
||||
// Intersection Observer for lazy loading thumbnails
|
||||
useEffect(() => {
|
||||
if (!loadMoreRef.current) return;
|
||||
@@ -538,13 +573,9 @@ export function MediaList({
|
||||
}
|
||||
setHasDownloaded(true);
|
||||
|
||||
// Check if there are GIFs and FFmpeg is installed
|
||||
const hasGifItems = itemsWithIndices.some(({ item }) => item.type === "gif" || item.type === "animated_gif");
|
||||
if (hasGifItems) {
|
||||
setHasGifs(true);
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
}
|
||||
// Check if FFmpeg is installed for GIF conversion
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
} else {
|
||||
logger.error(response.message);
|
||||
toast.error("Download failed");
|
||||
@@ -635,7 +666,16 @@ export function MediaList({
|
||||
if (response.success) {
|
||||
logger.success(`Converted ${response.converted} GIFs`);
|
||||
toast.success(`${response.converted} GIFs converted`);
|
||||
setHasGifs(false);
|
||||
// Re-check if gifs folder still has MP4 files after conversion
|
||||
const settings = getSettings();
|
||||
let folderName = accountInfo.name;
|
||||
if (accountInfo.nick === "My Bookmarks" || accountInfo.name === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (accountInfo.nick === "My Likes" || accountInfo.name === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
const hasMP4 = await CheckGifsFolderHasMP4(settings.downloadPath, folderName);
|
||||
setGifsFolderHasMP4(hasMP4);
|
||||
} else {
|
||||
logger.error(response.message);
|
||||
toast.error("Convert failed");
|
||||
@@ -745,24 +785,30 @@ export function MediaList({
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All ({formatNumberWithComma(totalUrls)})</SelectItem>
|
||||
<SelectItem value="photo">
|
||||
<span className="flex items-center gap-2">
|
||||
<Image className="h-4 w-4 text-blue-500" />
|
||||
Images ({formatNumberWithComma(mediaCounts.photo)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="video">
|
||||
<span className="flex items-center gap-2">
|
||||
<Video className="h-4 w-4 text-purple-500" />
|
||||
Videos ({formatNumberWithComma(mediaCounts.video)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="gif">
|
||||
<span className="flex items-center gap-2">
|
||||
<Film className="h-4 w-4 text-green-500" />
|
||||
GIFs ({formatNumberWithComma(mediaCounts.gif)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
{mediaCounts.photo > 0 && (
|
||||
<SelectItem value="photo">
|
||||
<span className="flex items-center gap-2">
|
||||
<Image className="h-4 w-4 text-blue-500" />
|
||||
Images ({formatNumberWithComma(mediaCounts.photo)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
{mediaCounts.video > 0 && (
|
||||
<SelectItem value="video">
|
||||
<span className="flex items-center gap-2">
|
||||
<Video className="h-4 w-4 text-purple-500" />
|
||||
Videos ({formatNumberWithComma(mediaCounts.video)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
{mediaCounts.gif > 0 && (
|
||||
<SelectItem value="gif">
|
||||
<span className="flex items-center gap-2">
|
||||
<Film className="h-4 w-4 text-green-500" />
|
||||
GIFs ({formatNumberWithComma(mediaCounts.gif)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
@@ -796,27 +842,23 @@ export function MediaList({
|
||||
</div>
|
||||
|
||||
<div className="flex-1" />
|
||||
{hasDownloaded && (
|
||||
<Button variant="outline" onClick={handleOpenFolder}>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
Open Folder
|
||||
</Button>
|
||||
)}
|
||||
{hasGifs && ffmpegInstalled && (
|
||||
<Button variant="outline" onClick={handleConvertGifs} disabled={isConverting}>
|
||||
{isConverting ? (
|
||||
<>
|
||||
<Spinner />
|
||||
Converting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Film className="h-4 w-4" />
|
||||
Convert GIFs
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="outline" onClick={handleOpenFolder} disabled={!folderExists}>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
Open Folder
|
||||
</Button>
|
||||
<Button variant="outline" onClick={handleConvertGifs} disabled={isConverting || !gifsFolderHasMP4 || !ffmpegInstalled}>
|
||||
{isConverting ? (
|
||||
<>
|
||||
<Spinner />
|
||||
Converting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Film className="h-4 w-4" />
|
||||
Convert GIFs
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
{isDownloading && (
|
||||
<Button variant="destructive" onClick={handleStopDownload}>
|
||||
@@ -1234,7 +1276,7 @@ export function MediaList({
|
||||
|
||||
{/* Counter - above media */}
|
||||
<div className="text-white text-sm bg-black/50 px-4 py-1.5 rounded-full mb-4">
|
||||
{previewIndex + 1} / {filteredTimeline.length}
|
||||
{formatNumberWithComma(previewIndex + 1)} / {formatNumberWithComma(filteredTimeline.length)}
|
||||
</div>
|
||||
|
||||
{/* Media content - center */}
|
||||
|
||||
@@ -28,6 +28,10 @@ import {
|
||||
AlertCircle,
|
||||
} from "lucide-react";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
|
||||
function formatNumberWithComma(num: number): string {
|
||||
return num.toLocaleString();
|
||||
}
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import {
|
||||
Select,
|
||||
@@ -386,7 +390,7 @@ export function SearchBar({
|
||||
{/* Timer Display */}
|
||||
{(remainingTime !== null || elapsedTime > 0) && (
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{remainingTime !== null && remainingTime >= 0
|
||||
? `${Math.floor(remainingTime / 60)}:${String(remainingTime % 60).padStart(2, "0")}`
|
||||
@@ -505,7 +509,7 @@ export function SearchBar({
|
||||
{/* Timer Display */}
|
||||
{(remainingTime !== null || elapsedTime > 0) && (
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{remainingTime !== null && remainingTime >= 0
|
||||
? `${Math.floor(remainingTime / 60)}:${String(remainingTime % 60).padStart(2, "0")}`
|
||||
@@ -614,10 +618,10 @@ export function SearchBar({
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All Media</SelectItem>
|
||||
<SelectItem value="image">Images Only</SelectItem>
|
||||
<SelectItem value="video">Videos Only</SelectItem>
|
||||
<SelectItem value="gif">GIFs Only</SelectItem>
|
||||
<SelectItem value="text">Text Only (No Media)</SelectItem>
|
||||
<SelectItem value="image">Images</SelectItem>
|
||||
<SelectItem value="video">Videos</SelectItem>
|
||||
<SelectItem value="gif">GIFs</SelectItem>
|
||||
<SelectItem value="text">Text (No Media)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -688,29 +692,29 @@ export function SearchBar({
|
||||
<CheckCircle className="h-4 w-4 text-green-600 dark:text-green-400" />
|
||||
<span className="text-muted-foreground">Completed:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "completed").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "completed").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<AlertCircle className="h-4 w-4 text-yellow-600 dark:text-yellow-400" />
|
||||
<span className="text-muted-foreground">Incomplete:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "incomplete").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "incomplete").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<XCircle className="h-4 w-4 text-red-600 dark:text-red-400" />
|
||||
<span className="text-muted-foreground">Failed:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "failed").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "failed").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<span className="text-muted-foreground">Total:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) =>
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) =>
|
||||
acc.status === "completed" || acc.status === "incomplete" || acc.status === "failed"
|
||||
).length}/{multipleAccounts.length}
|
||||
).length)}/{formatNumberWithComma(multipleAccounts.length)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -720,7 +724,7 @@ export function SearchBar({
|
||||
{/* Account List - below auth token and advanced settings */}
|
||||
{fetchType === "multiple" && multipleAccounts.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm text-muted-foreground">Accounts to Fetch ({multipleAccounts.length})</p>
|
||||
<p className="text-sm text-muted-foreground">Accounts to Fetch ({formatNumberWithComma(multipleAccounts.length)})</p>
|
||||
<div className="space-y-2 max-h-[400px] overflow-y-auto">
|
||||
{multipleAccounts.map((account) => (
|
||||
<div
|
||||
@@ -767,7 +771,7 @@ export function SearchBar({
|
||||
{account.status === "fetching" && (
|
||||
<>
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{account.remainingTime !== null && account.remainingTime >= 0
|
||||
? formatTime(account.remainingTime)
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { FolderOpen, Save, RotateCcw, Info, Download, Check, Volume2 } from "lucide-react";
|
||||
import { FolderOpen, Save, RotateCcw, Info, Download, Check } from "lucide-react";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { getSettings, getSettingsWithDefaults, saveSettings, resetToDefaultSettings, applyThemeMode, applyFont, FONT_OPTIONS, type Settings as SettingsType, type FontFamily, type GifQuality, type GifResolution } from "@/lib/settings";
|
||||
@@ -215,7 +215,6 @@ export function SettingsPage() {
|
||||
|
||||
{/* Sound Effects */}
|
||||
<div className="flex items-center gap-3 pt-2">
|
||||
<Volume2 className="h-4 w-4 text-muted-foreground" />
|
||||
<Label htmlFor="sfx-enabled" className="cursor-pointer text-sm">Sound Effects</Label>
|
||||
<Switch
|
||||
id="sfx-enabled"
|
||||
@@ -315,51 +314,42 @@ export function SettingsPage() {
|
||||
|
||||
{/* GIF Quality - only show if FFmpeg installed */}
|
||||
{ffmpegInstalled && (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-quality">GIF Quality</Label>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-quality">GIF Quality</Label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Select
|
||||
value={tempSettings.gifQuality}
|
||||
onValueChange={(value: GifQuality) => {
|
||||
setTempSettings((prev) => ({
|
||||
...prev,
|
||||
gifQuality: value,
|
||||
// Auto-select "original" when switching to "better"
|
||||
gifResolution: value === "better" ? "original" : prev.gifResolution,
|
||||
}));
|
||||
}}
|
||||
>
|
||||
<SelectTrigger id="gif-quality">
|
||||
<SelectTrigger id="gif-quality" className="w-auto">
|
||||
<SelectValue placeholder="Select quality" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="fast">Fast (Simple conversion)</SelectItem>
|
||||
<SelectItem value="better">Better (Optimized palette)</SelectItem>
|
||||
<SelectItem value="fast">Fast</SelectItem>
|
||||
<SelectItem value="better">Better</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select
|
||||
value={tempSettings.gifResolution}
|
||||
onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))}
|
||||
>
|
||||
<SelectTrigger id="gif-resolution" className="w-auto">
|
||||
<SelectValue placeholder="Resolution" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="original">Original</SelectItem>
|
||||
<SelectItem value="high">High (800px)</SelectItem>
|
||||
<SelectItem value="medium">Medium (600px)</SelectItem>
|
||||
<SelectItem value="low">Low (400px)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* GIF Resolution - only show if Better quality selected */}
|
||||
{tempSettings.gifQuality === "better" && (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-resolution">GIF Resolution</Label>
|
||||
<Select
|
||||
value={tempSettings.gifResolution}
|
||||
onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))}
|
||||
>
|
||||
<SelectTrigger id="gif-resolution">
|
||||
<SelectValue placeholder="Select resolution" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="original">Original (No scaling, 15 fps)</SelectItem>
|
||||
<SelectItem value="high">High (800px, 15 fps)</SelectItem>
|
||||
<SelectItem value="medium">Medium (600px, 10 fps)</SelectItem>
|
||||
<SelectItem value="low">Low (400px, 8 fps)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Proxy */}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Home, Settings, Bug, Database, LayoutGrid } from "lucide-react";
|
||||
import { Home, Settings, Bug, Database, LayoutGrid, Coffee, Github } from "lucide-react";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -44,27 +44,23 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* GitHub - below debug */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues")}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="currentColor">
|
||||
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
|
||||
</svg>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Report Bug</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{/* Other Projects at bottom */}
|
||||
<div className="mt-auto">
|
||||
{/* Bottom icons */}
|
||||
<div className="mt-auto flex flex-col gap-2">
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues")}
|
||||
>
|
||||
<Github className="h-5 w-5" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Report Bug</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
@@ -80,6 +76,21 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
||||
<p>Other Projects</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://ko-fi.com/afkarxyz")}
|
||||
>
|
||||
<Coffee className="h-5 w-5" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Support me on Ko-fi</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
||||
import { ChevronDownIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Accordion({
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
||||
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
||||
}
|
||||
|
||||
function AccordionItem({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
||||
return (
|
||||
<AccordionPrimitive.Item
|
||||
data-slot="accordion-item"
|
||||
className={cn("border-b last:border-b-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AccordionTrigger({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
||||
return (
|
||||
<AccordionPrimitive.Header className="flex">
|
||||
<AccordionPrimitive.Trigger
|
||||
data-slot="accordion-trigger"
|
||||
className={cn(
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
||||
</AccordionPrimitive.Trigger>
|
||||
</AccordionPrimitive.Header>
|
||||
)
|
||||
}
|
||||
|
||||
function AccordionContent({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
||||
return (
|
||||
<AccordionPrimitive.Content
|
||||
data-slot="accordion-content"
|
||||
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
||||
{...props}
|
||||
>
|
||||
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
||||
</AccordionPrimitive.Content>
|
||||
)
|
||||
}
|
||||
|
||||
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
||||
@@ -1,92 +0,0 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-none font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn(
|
||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardFooter,
|
||||
CardTitle,
|
||||
CardAction,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
import * as React from "react"
|
||||
import {
|
||||
ChevronLeftIcon,
|
||||
ChevronRightIcon,
|
||||
MoreHorizontalIcon,
|
||||
} from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button, buttonVariants } from "@/components/ui/button"
|
||||
|
||||
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
||||
return (
|
||||
<nav
|
||||
role="navigation"
|
||||
aria-label="pagination"
|
||||
data-slot="pagination"
|
||||
className={cn("mx-auto flex w-full justify-center", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationContent({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"ul">) {
|
||||
return (
|
||||
<ul
|
||||
data-slot="pagination-content"
|
||||
className={cn("flex flex-row items-center gap-1", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
||||
return <li data-slot="pagination-item" {...props} />
|
||||
}
|
||||
|
||||
type PaginationLinkProps = {
|
||||
isActive?: boolean
|
||||
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
||||
React.ComponentProps<"a">
|
||||
|
||||
function PaginationLink({
|
||||
className,
|
||||
isActive,
|
||||
size = "icon",
|
||||
...props
|
||||
}: PaginationLinkProps) {
|
||||
return (
|
||||
<a
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
data-slot="pagination-link"
|
||||
data-active={isActive}
|
||||
className={cn(
|
||||
buttonVariants({
|
||||
variant: isActive ? "outline" : "ghost",
|
||||
size,
|
||||
}),
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationPrevious({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof PaginationLink>) {
|
||||
return (
|
||||
<PaginationLink
|
||||
aria-label="Go to previous page"
|
||||
size="default"
|
||||
className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronLeftIcon />
|
||||
<span className="hidden sm:block">Previous</span>
|
||||
</PaginationLink>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationNext({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof PaginationLink>) {
|
||||
return (
|
||||
<PaginationLink
|
||||
aria-label="Go to next page"
|
||||
size="default"
|
||||
className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
|
||||
{...props}
|
||||
>
|
||||
<span className="hidden sm:block">Next</span>
|
||||
<ChevronRightIcon />
|
||||
</PaginationLink>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationEllipsis({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"span">) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden
|
||||
data-slot="pagination-ellipsis"
|
||||
className={cn("flex size-9 items-center justify-center", className)}
|
||||
{...props}
|
||||
>
|
||||
<MoreHorizontalIcon className="size-4" />
|
||||
<span className="sr-only">More pages</span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
PaginationLink,
|
||||
PaginationItem,
|
||||
PaginationPrevious,
|
||||
PaginationNext,
|
||||
PaginationEllipsis,
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
||||
import { CircleIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function RadioGroup({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
||||
return (
|
||||
<RadioGroupPrimitive.Root
|
||||
data-slot="radio-group"
|
||||
className={cn("grid gap-3", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function RadioGroupItem({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
||||
return (
|
||||
<RadioGroupPrimitive.Item
|
||||
data-slot="radio-group-item"
|
||||
className={cn(
|
||||
"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<RadioGroupPrimitive.Indicator
|
||||
data-slot="radio-group-indicator"
|
||||
className="relative flex items-center justify-center"
|
||||
>
|
||||
<CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
|
||||
</RadioGroupPrimitive.Indicator>
|
||||
</RadioGroupPrimitive.Item>
|
||||
)
|
||||
}
|
||||
|
||||
export { RadioGroup, RadioGroupItem }
|
||||
+48
-44
@@ -26,19 +26,6 @@
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
}
|
||||
|
||||
:root {
|
||||
@@ -61,19 +48,6 @@
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
@@ -95,19 +69,6 @@
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -164,6 +125,54 @@
|
||||
@apply text-blue-600;
|
||||
}
|
||||
|
||||
/* Ensure description text uses same color as title */
|
||||
[data-sonner-toast] [data-description],
|
||||
[data-sonner-toast] [data-description] * {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
/* Specific color for each toast type - match icon color */
|
||||
[data-sonner-toast][data-type="success"] [data-description],
|
||||
[data-sonner-toast][data-type="success"] [data-description] * {
|
||||
color: rgb(22 163 74) !important; /* green-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="error"] [data-description],
|
||||
[data-sonner-toast][data-type="error"] [data-description] * {
|
||||
color: rgb(220 38 38) !important; /* red-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="warning"] [data-description],
|
||||
[data-sonner-toast][data-type="warning"] [data-description] * {
|
||||
color: rgb(202 138 4) !important; /* yellow-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="info"] [data-description],
|
||||
[data-sonner-toast][data-type="info"] [data-description] * {
|
||||
color: rgb(37 99 235) !important; /* blue-600 - same as icon */
|
||||
}
|
||||
|
||||
/* Dark mode - use same icon colors */
|
||||
.dark [data-sonner-toast][data-type="success"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="success"] [data-description] * {
|
||||
color: rgb(22 163 74) !important; /* green-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="error"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="error"] [data-description] * {
|
||||
color: rgb(220 38 38) !important; /* red-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="warning"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="warning"] [data-description] * {
|
||||
color: rgb(202 138 4) !important; /* yellow-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="info"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="info"] [data-description] * {
|
||||
color: rgb(37 99 235) !important; /* blue-600 */
|
||||
}
|
||||
|
||||
/* Dark mode toast styling */
|
||||
.dark [data-sonner-toast][data-type="success"] {
|
||||
@apply bg-green-950 border-green-800 text-green-100;
|
||||
@@ -244,8 +253,3 @@
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
|
||||
/* Date input styling for dark mode */
|
||||
.dark input[type="date"]::-webkit-calendar-picker-indicator {
|
||||
filter: invert(1);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GetDefaults } from "../../wailsjs/go/main/App";
|
||||
|
||||
export type FontFamily = "google-sans" | "inter" | "poppins" | "roboto" | "dm-sans" | "plus-jakarta-sans" | "manrope" | "space-grotesk";
|
||||
export type FontFamily = "google-sans" | "inter" | "poppins" | "roboto" | "dm-sans" | "plus-jakarta-sans" | "manrope" | "space-grotesk" | "noto-sans" | "nunito-sans" | "figtree" | "raleway" | "public-sans" | "outfit" | "jetbrains-mono" | "geist-sans";
|
||||
export type GifQuality = "fast" | "better";
|
||||
export type GifResolution = "original" | "high" | "medium" | "low";
|
||||
|
||||
@@ -23,19 +23,27 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
fontFamily: "google-sans",
|
||||
sfxEnabled: true,
|
||||
gifQuality: "fast",
|
||||
gifResolution: "high",
|
||||
gifResolution: "original",
|
||||
proxy: "",
|
||||
fetchTimeout: 60, // Default: 60 seconds
|
||||
};
|
||||
|
||||
export const FONT_OPTIONS: { value: FontFamily; label: string; fontFamily: string }[] = [
|
||||
{ value: "dm-sans", label: "DM Sans", fontFamily: '"DM Sans", system-ui, sans-serif' },
|
||||
{ value: "figtree", label: "Figtree", fontFamily: '"Figtree", system-ui, sans-serif' },
|
||||
{ value: "geist-sans", label: "Geist Sans", fontFamily: '"Geist", system-ui, sans-serif' },
|
||||
{ value: "google-sans", label: "Google Sans Flex", fontFamily: '"Google Sans Flex", system-ui, sans-serif' },
|
||||
{ value: "inter", label: "Inter", fontFamily: '"Inter", system-ui, sans-serif' },
|
||||
{ value: "poppins", label: "Poppins", fontFamily: '"Poppins", system-ui, sans-serif' },
|
||||
{ value: "roboto", label: "Roboto", fontFamily: '"Roboto", system-ui, sans-serif' },
|
||||
{ value: "dm-sans", label: "DM Sans", fontFamily: '"DM Sans", system-ui, sans-serif' },
|
||||
{ value: "plus-jakarta-sans", label: "Plus Jakarta Sans", fontFamily: '"Plus Jakarta Sans", system-ui, sans-serif' },
|
||||
{ value: "jetbrains-mono", label: "JetBrains Mono", fontFamily: '"JetBrains Mono", ui-monospace, monospace' },
|
||||
{ value: "manrope", label: "Manrope", fontFamily: '"Manrope", system-ui, sans-serif' },
|
||||
{ value: "noto-sans", label: "Noto Sans", fontFamily: '"Noto Sans", system-ui, sans-serif' },
|
||||
{ value: "nunito-sans", label: "Nunito Sans", fontFamily: '"Nunito Sans", system-ui, sans-serif' },
|
||||
{ value: "outfit", label: "Outfit", fontFamily: '"Outfit", system-ui, sans-serif' },
|
||||
{ value: "plus-jakarta-sans", label: "Plus Jakarta Sans", fontFamily: '"Plus Jakarta Sans", system-ui, sans-serif' },
|
||||
{ value: "poppins", label: "Poppins", fontFamily: '"Poppins", system-ui, sans-serif' },
|
||||
{ value: "public-sans", label: "Public Sans", fontFamily: '"Public Sans", system-ui, sans-serif' },
|
||||
{ value: "raleway", label: "Raleway", fontFamily: '"Raleway", system-ui, sans-serif' },
|
||||
{ value: "roboto", label: "Roboto", fontFamily: '"Roboto", system-ui, sans-serif' },
|
||||
{ value: "space-grotesk", label: "Space Grotesk", fontFamily: '"Space Grotesk", system-ui, sans-serif' },
|
||||
];
|
||||
|
||||
|
||||
+269
-449
@@ -7,456 +7,276 @@ export interface Theme {
|
||||
};
|
||||
}
|
||||
|
||||
// Base colors yang sama untuk semua tema (kecuali primary dan primary-foreground)
|
||||
const baseLightColors: Record<string, string> = {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.145 0 0)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.145 0 0)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.145 0 0)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.97 0 0)",
|
||||
"muted-foreground": "oklch(0.556 0 0)",
|
||||
accent: "oklch(0.97 0 0)",
|
||||
"accent-foreground": "oklch(0.205 0 0)",
|
||||
destructive: "oklch(0.58 0.22 27)",
|
||||
border: "oklch(0.922 0 0)",
|
||||
input: "oklch(0.922 0 0)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
};
|
||||
|
||||
const baseDarkColors: Record<string, string> = {
|
||||
background: "oklch(0.145 0 0)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.205 0 0)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.205 0 0)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.269 0 0)",
|
||||
"muted-foreground": "oklch(0.708 0 0)",
|
||||
accent: "oklch(0.371 0 0)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
};
|
||||
|
||||
// Primary colors yang berbeda untuk setiap tema
|
||||
interface PrimaryColors {
|
||||
light: {
|
||||
primary: string;
|
||||
"primary-foreground": string;
|
||||
};
|
||||
dark: {
|
||||
primary: string;
|
||||
"primary-foreground": string;
|
||||
};
|
||||
}
|
||||
|
||||
const primaryColors: Record<string, PrimaryColors> = {
|
||||
amber: {
|
||||
light: {
|
||||
primary: "oklch(0.67 0.16 58)",
|
||||
"primary-foreground": "oklch(0.99 0.02 95)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.77 0.16 70)",
|
||||
"primary-foreground": "oklch(0.28 0.07 46)",
|
||||
},
|
||||
},
|
||||
blue: {
|
||||
light: {
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.42 0.18 266)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
},
|
||||
},
|
||||
cyan: {
|
||||
light: {
|
||||
primary: "oklch(0.61 0.11 222)",
|
||||
"primary-foreground": "oklch(0.98 0.02 201)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.71 0.13 215)",
|
||||
"primary-foreground": "oklch(0.30 0.05 230)",
|
||||
},
|
||||
},
|
||||
emerald: {
|
||||
light: {
|
||||
primary: "oklch(0.60 0.13 163)",
|
||||
"primary-foreground": "oklch(0.98 0.02 166)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.70 0.15 162)",
|
||||
"primary-foreground": "oklch(0.26 0.05 173)",
|
||||
},
|
||||
},
|
||||
fuchsia: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.26 323)",
|
||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.67 0.26 322)",
|
||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
||||
},
|
||||
},
|
||||
green: {
|
||||
light: {
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
},
|
||||
},
|
||||
indigo: {
|
||||
light: {
|
||||
primary: "oklch(0.51 0.23 277)",
|
||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.59 0.20 277)",
|
||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
||||
},
|
||||
},
|
||||
lime: {
|
||||
light: {
|
||||
primary: "oklch(0.65 0.18 132)",
|
||||
"primary-foreground": "oklch(0.99 0.03 121)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.77 0.20 131)",
|
||||
"primary-foreground": "oklch(0.27 0.07 132)",
|
||||
},
|
||||
},
|
||||
neutral: {
|
||||
light: {
|
||||
primary: "oklch(0.205 0 0)",
|
||||
"primary-foreground": "oklch(0.985 0 0)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.922 0 0)",
|
||||
"primary-foreground": "oklch(0.205 0 0)",
|
||||
},
|
||||
},
|
||||
orange: {
|
||||
light: {
|
||||
primary: "oklch(0.646 0.222 41.116)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.705 0.213 47.604)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
},
|
||||
},
|
||||
pink: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.22 1)",
|
||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.66 0.21 354)",
|
||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
||||
},
|
||||
},
|
||||
purple: {
|
||||
light: {
|
||||
primary: "oklch(0.56 0.25 302)",
|
||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.63 0.23 304)",
|
||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
||||
},
|
||||
},
|
||||
red: {
|
||||
light: {
|
||||
primary: "oklch(0.577 0.245 27.325)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.637 0.237 25.331)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
},
|
||||
},
|
||||
rose: {
|
||||
light: {
|
||||
primary: "oklch(0.586 0.253 17.585)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.645 0.246 16.439)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
},
|
||||
},
|
||||
sky: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.14 242)",
|
||||
"primary-foreground": "oklch(0.98 0.01 237)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.68 0.15 237)",
|
||||
"primary-foreground": "oklch(0.29 0.06 243)",
|
||||
},
|
||||
},
|
||||
teal: {
|
||||
light: {
|
||||
primary: "oklch(0.60 0.10 185)",
|
||||
"primary-foreground": "oklch(0.98 0.01 181)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.70 0.12 183)",
|
||||
"primary-foreground": "oklch(0.28 0.04 193)",
|
||||
},
|
||||
},
|
||||
violet: {
|
||||
light: {
|
||||
primary: "oklch(0.541 0.281 293.009)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.606 0.25 292.717)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
},
|
||||
},
|
||||
yellow: {
|
||||
light: {
|
||||
primary: "oklch(0.852 0.199 91.936)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.795 0.184 86.047)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Helper function untuk menggabungkan base colors dengan primary colors
|
||||
function createTheme(
|
||||
name: string,
|
||||
label: string,
|
||||
primary: PrimaryColors
|
||||
): Theme {
|
||||
return {
|
||||
name,
|
||||
label,
|
||||
cssVars: {
|
||||
light: { ...baseLightColors, ...primary.light },
|
||||
dark: { ...baseDarkColors, ...primary.dark },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const themes: Theme[] = [
|
||||
{
|
||||
name: "neutral",
|
||||
label: "Default",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.145 0 0)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.145 0 0)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.145 0 0)",
|
||||
primary: "oklch(0.205 0 0)",
|
||||
"primary-foreground": "oklch(0.985 0 0)",
|
||||
secondary: "oklch(0.97 0 0)",
|
||||
"secondary-foreground": "oklch(0.205 0 0)",
|
||||
muted: "oklch(0.97 0 0)",
|
||||
"muted-foreground": "oklch(0.556 0 0)",
|
||||
accent: "oklch(0.97 0 0)",
|
||||
"accent-foreground": "oklch(0.205 0 0)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.922 0 0)",
|
||||
input: "oklch(0.922 0 0)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
"chart-1": "oklch(0.646 0.222 41.116)",
|
||||
"chart-2": "oklch(0.6 0.118 184.704)",
|
||||
"chart-3": "oklch(0.398 0.07 227.392)",
|
||||
"chart-4": "oklch(0.828 0.189 84.429)",
|
||||
"chart-5": "oklch(0.769 0.188 70.08)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.145 0 0)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.205 0 0)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.205 0 0)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.922 0 0)",
|
||||
"primary-foreground": "oklch(0.205 0 0)",
|
||||
secondary: "oklch(0.269 0 0)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.269 0 0)",
|
||||
"muted-foreground": "oklch(0.708 0 0)",
|
||||
accent: "oklch(0.269 0 0)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
"chart-1": "oklch(0.488 0.243 264.376)",
|
||||
"chart-2": "oklch(0.696 0.17 162.48)",
|
||||
"chart-3": "oklch(0.769 0.188 70.08)",
|
||||
"chart-4": "oklch(0.627 0.265 303.9)",
|
||||
"chart-5": "oklch(0.645 0.246 16.439)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "blue",
|
||||
label: "Blue",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
"chart-1": "oklch(0.809 0.105 251.813)",
|
||||
"chart-2": "oklch(0.623 0.214 259.815)",
|
||||
"chart-3": "oklch(0.546 0.245 262.881)",
|
||||
"chart-4": "oklch(0.488 0.243 264.376)",
|
||||
"chart-5": "oklch(0.424 0.199 265.638)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
"chart-1": "oklch(0.809 0.105 251.813)",
|
||||
"chart-2": "oklch(0.623 0.214 259.815)",
|
||||
"chart-3": "oklch(0.546 0.245 262.881)",
|
||||
"chart-4": "oklch(0.488 0.243 264.376)",
|
||||
"chart-5": "oklch(0.424 0.199 265.638)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "green",
|
||||
label: "Green",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.841 0.238 128.85)",
|
||||
"chart-1": "oklch(0.871 0.15 154.449)",
|
||||
"chart-2": "oklch(0.723 0.219 149.579)",
|
||||
"chart-3": "oklch(0.627 0.194 149.214)",
|
||||
"chart-4": "oklch(0.527 0.154 150.069)",
|
||||
"chart-5": "oklch(0.448 0.119 151.328)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.405 0.101 131.063)",
|
||||
"chart-1": "oklch(0.871 0.15 154.449)",
|
||||
"chart-2": "oklch(0.723 0.219 149.579)",
|
||||
"chart-3": "oklch(0.627 0.194 149.214)",
|
||||
"chart-4": "oklch(0.527 0.154 150.069)",
|
||||
"chart-5": "oklch(0.448 0.119 151.328)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "orange",
|
||||
label: "Orange",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.646 0.222 41.116)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.75 0.183 55.934)",
|
||||
"chart-1": "oklch(0.837 0.128 66.29)",
|
||||
"chart-2": "oklch(0.705 0.213 47.604)",
|
||||
"chart-3": "oklch(0.646 0.222 41.116)",
|
||||
"chart-4": "oklch(0.553 0.195 38.402)",
|
||||
"chart-5": "oklch(0.47 0.157 37.304)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.705 0.213 47.604)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.408 0.123 38.172)",
|
||||
"chart-1": "oklch(0.837 0.128 66.29)",
|
||||
"chart-2": "oklch(0.705 0.213 47.604)",
|
||||
"chart-3": "oklch(0.646 0.222 41.116)",
|
||||
"chart-4": "oklch(0.553 0.195 38.402)",
|
||||
"chart-5": "oklch(0.47 0.157 37.304)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "red",
|
||||
label: "Red",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.577 0.245 27.325)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.704 0.191 22.216)",
|
||||
"chart-1": "oklch(0.808 0.114 19.571)",
|
||||
"chart-2": "oklch(0.637 0.237 25.331)",
|
||||
"chart-3": "oklch(0.577 0.245 27.325)",
|
||||
"chart-4": "oklch(0.505 0.213 27.518)",
|
||||
"chart-5": "oklch(0.444 0.177 26.899)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.637 0.237 25.331)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.396 0.141 25.723)",
|
||||
"chart-1": "oklch(0.808 0.114 19.571)",
|
||||
"chart-2": "oklch(0.637 0.237 25.331)",
|
||||
"chart-3": "oklch(0.577 0.245 27.325)",
|
||||
"chart-4": "oklch(0.505 0.213 27.518)",
|
||||
"chart-5": "oklch(0.444 0.177 26.899)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "rose",
|
||||
label: "Rose",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.586 0.253 17.585)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.712 0.194 13.428)",
|
||||
"chart-1": "oklch(0.81 0.117 11.638)",
|
||||
"chart-2": "oklch(0.645 0.246 16.439)",
|
||||
"chart-3": "oklch(0.586 0.253 17.585)",
|
||||
"chart-4": "oklch(0.514 0.222 16.935)",
|
||||
"chart-5": "oklch(0.455 0.188 13.697)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.645 0.246 16.439)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.41 0.159 10.272)",
|
||||
"chart-1": "oklch(0.81 0.117 11.638)",
|
||||
"chart-2": "oklch(0.645 0.246 16.439)",
|
||||
"chart-3": "oklch(0.586 0.253 17.585)",
|
||||
"chart-4": "oklch(0.514 0.222 16.935)",
|
||||
"chart-5": "oklch(0.455 0.188 13.697)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "violet",
|
||||
label: "Violet",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.541 0.281 293.009)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.702 0.183 293.541)",
|
||||
"chart-1": "oklch(0.811 0.111 293.571)",
|
||||
"chart-2": "oklch(0.606 0.25 292.717)",
|
||||
"chart-3": "oklch(0.541 0.281 293.009)",
|
||||
"chart-4": "oklch(0.491 0.27 292.581)",
|
||||
"chart-5": "oklch(0.432 0.232 292.759)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.606 0.25 292.717)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.38 0.189 293.745)",
|
||||
"chart-1": "oklch(0.811 0.111 293.571)",
|
||||
"chart-2": "oklch(0.606 0.25 292.717)",
|
||||
"chart-3": "oklch(0.541 0.281 293.009)",
|
||||
"chart-4": "oklch(0.491 0.27 292.581)",
|
||||
"chart-5": "oklch(0.432 0.232 292.759)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "yellow",
|
||||
label: "Yellow",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.852 0.199 91.936)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.852 0.199 91.936)",
|
||||
"chart-1": "oklch(0.905 0.182 98.111)",
|
||||
"chart-2": "oklch(0.795 0.184 86.047)",
|
||||
"chart-3": "oklch(0.681 0.162 75.834)",
|
||||
"chart-4": "oklch(0.554 0.135 66.442)",
|
||||
"chart-5": "oklch(0.476 0.114 61.907)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.795 0.184 86.047)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.421 0.095 57.708)",
|
||||
"chart-1": "oklch(0.905 0.182 98.111)",
|
||||
"chart-2": "oklch(0.795 0.184 86.047)",
|
||||
"chart-3": "oklch(0.681 0.162 75.834)",
|
||||
"chart-4": "oklch(0.554 0.135 66.442)",
|
||||
"chart-5": "oklch(0.476 0.114 61.907)",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
createTheme("amber", "Amber", primaryColors.amber),
|
||||
createTheme("blue", "Blue", primaryColors.blue),
|
||||
createTheme("cyan", "Cyan", primaryColors.cyan),
|
||||
createTheme("emerald", "Emerald", primaryColors.emerald),
|
||||
createTheme("fuchsia", "Fuchsia", primaryColors.fuchsia),
|
||||
createTheme("green", "Green", primaryColors.green),
|
||||
createTheme("indigo", "Indigo", primaryColors.indigo),
|
||||
createTheme("lime", "Lime", primaryColors.lime),
|
||||
createTheme("neutral", "Neutral", primaryColors.neutral),
|
||||
createTheme("orange", "Orange", primaryColors.orange),
|
||||
createTheme("pink", "Pink", primaryColors.pink),
|
||||
createTheme("purple", "Purple", primaryColors.purple),
|
||||
createTheme("red", "Red", primaryColors.red),
|
||||
createTheme("rose", "Rose", primaryColors.rose),
|
||||
createTheme("sky", "Sky", primaryColors.sky),
|
||||
createTheme("teal", "Teal", primaryColors.teal),
|
||||
createTheme("violet", "Violet", primaryColors.violet),
|
||||
createTheme("yellow", "Yellow", primaryColors.yellow),
|
||||
].sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
export function applyTheme(themeName: string) {
|
||||
const theme = themes.find((t) => t.name === themeName) || themes[0];
|
||||
|
||||
+29
-35
@@ -6,10 +6,7 @@ CLI tool for extracting media and metadata from Twitter/X using gallery-dl extra
|
||||
|
||||
### Required
|
||||
- `url` — Twitter/X URL (timeline, media, likes, search, etc.)
|
||||
|
||||
### Authentication
|
||||
- `--auth-token TOKEN` — Your auth_token cookie value
|
||||
- `--guest` — Force guest mode (no authentication)
|
||||
- `--auth-token TOKEN` — Your auth_token cookie value (required)
|
||||
|
||||
### Content Options
|
||||
- `--retweets {skip|include|original}` — Control retweets (default: skip)
|
||||
@@ -42,10 +39,7 @@ CLI tool for extracting media and metadata from Twitter/X using gallery-dl extra
|
||||
### Basic Fetch
|
||||
|
||||
```powershell
|
||||
# Guest mode (no auth)
|
||||
python twitter_cli.py https://x.com/username/media --limit 10 --json --guest
|
||||
|
||||
# With authentication
|
||||
# Fetch media with authentication
|
||||
python twitter_cli.py https://x.com/username/media --limit 10 --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
@@ -53,49 +47,49 @@ python twitter_cli.py https://x.com/username/media --limit 10 --json --auth-toke
|
||||
|
||||
```powershell
|
||||
# Photos only
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Videos only
|
||||
python twitter_cli.py https://x.com/username/media --type video --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type video --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Animated GIFs only
|
||||
python twitter_cli.py https://x.com/username/media --type animated_gif --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type animated_gif --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### With Metadata
|
||||
|
||||
```powershell
|
||||
# Include tweet metadata (author, date, counts)
|
||||
python twitter_cli.py https://x.com/username/media --limit 5 --json --metadata --guest
|
||||
python twitter_cli.py https://x.com/username/media --limit 5 --json --metadata --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Retweets Control
|
||||
|
||||
```powershell
|
||||
# Skip retweets (default)
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets skip --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets skip --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Include retweets
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets include --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets include --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Get original tweet from retweets
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets original --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets original --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Save & Resume
|
||||
|
||||
```powershell
|
||||
# Save to file (with resume capability)
|
||||
python twitter_cli.py https://x.com/username/media --limit 100 --output results.json --progress --guest
|
||||
python twitter_cli.py https://x.com/username/media --limit 100 --output results.json --progress --auth-token YOUR_TOKEN
|
||||
|
||||
# Resume from saved file
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 100 --output results.json --guest
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 100 --output results.json --auth-token YOUR_TOKEN
|
||||
|
||||
# Fetch all remaining
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 0 --output results.json --guest
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 0 --output results.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Private Content (Requires Auth)
|
||||
### Private Content
|
||||
|
||||
```powershell
|
||||
# Your likes
|
||||
@@ -109,30 +103,30 @@ python twitter_cli.py https://x.com/i/bookmarks --limit 20 --json --auth-token Y
|
||||
|
||||
```powershell
|
||||
# Search with filters
|
||||
python twitter_cli.py "https://x.com/search?q=from:username filter:media" --limit 50 --json --guest
|
||||
python twitter_cli.py "https://x.com/search?q=from:username filter:media" --limit 50 --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Date range search
|
||||
python twitter_cli.py "https://x.com/search?q=from:username since:2024-01-01 until:2024-12-31" --json --guest
|
||||
python twitter_cli.py "https://x.com/search?q=from:username since:2024-01-01 until:2024-12-31" --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Advanced Filtering
|
||||
|
||||
```powershell
|
||||
# Filter by date (2024 only)
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="date.year == 2024" --guest
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="date.year == 2024" --auth-token YOUR_TOKEN
|
||||
|
||||
# Filter by engagement (>1000 likes)
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="favorite_count > 1000" --guest
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="favorite_count > 1000" --auth-token YOUR_TOKEN
|
||||
|
||||
# Combine filters (photos from 2024 with >100 likes)
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --metadata --set filter="date.year == 2024 and favorite_count > 100" --guest
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --metadata --set filter="date.year == 2024 and favorite_count > 100" --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Text-Only Tweets
|
||||
|
||||
```powershell
|
||||
# Fetch tweets without media
|
||||
python twitter_cli.py https://x.com/username/tweets --text-tweets --json --metadata --guest
|
||||
python twitter_cli.py https://x.com/username/tweets --text-tweets --json --metadata --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
---
|
||||
@@ -200,16 +194,16 @@ When using `--output`, the file includes:
|
||||
|
||||
```powershell
|
||||
# Step 1: Initial fetch (saves state)
|
||||
python twitter_cli.py https://x.com/user/media --limit 100 --output data.json --progress --guest
|
||||
python twitter_cli.py https://x.com/user/media --limit 100 --output data.json --progress --auth-token YOUR_TOKEN
|
||||
# Output: Saved 202 media to data.json [partial (can resume)]
|
||||
|
||||
# Step 2: Resume and fetch more
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 100 --output data.json --guest
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 100 --output data.json --auth-token YOUR_TOKEN
|
||||
# Output: Resuming from cursor, 202 media already fetched
|
||||
# Added 100 new media (total: 302)
|
||||
|
||||
# Step 3: Fetch all remaining
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --output data.json --guest
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --output data.json --auth-token YOUR_TOKEN
|
||||
# Output: Added 244 new media (total: 546) [completed]
|
||||
```
|
||||
|
||||
@@ -222,10 +216,10 @@ python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --ou
|
||||
- `https://x.com/username/timeline` — Full timeline
|
||||
- `https://x.com/username/tweets` — Tweets only
|
||||
- `https://x.com/username/with_replies` — With replies
|
||||
- `https://x.com/username/likes` — Liked tweets (requires auth)
|
||||
- `https://x.com/username/likes` — Liked tweets
|
||||
|
||||
### Private Content
|
||||
- `https://x.com/i/bookmarks` — Your bookmarks (requires auth)
|
||||
- `https://x.com/i/bookmarks` — Your bookmarks
|
||||
|
||||
### Search
|
||||
- `https://x.com/search?q=QUERY` — Search tweets
|
||||
@@ -260,22 +254,22 @@ Use in search URLs:
|
||||
### 1. Progressive Fetch with Resume
|
||||
```powershell
|
||||
# Fetch in batches to avoid long waits
|
||||
python twitter_cli.py URL --limit 200 --output data.json --progress --guest
|
||||
python twitter_cli.py URL --resume data.json --limit 200 --output data.json --guest
|
||||
python twitter_cli.py URL --limit 200 --output data.json --progress --auth-token YOUR_TOKEN
|
||||
python twitter_cli.py URL --resume data.json --limit 200 --output data.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 2. Combine Type Filter with Custom Filter
|
||||
```powershell
|
||||
# Photos from 2024 with high engagement
|
||||
python twitter_cli.py URL --type photo --metadata --set filter="date.year == 2024 and favorite_count > 500" --json --guest
|
||||
python twitter_cli.py URL --type photo --metadata --set filter="date.year == 2024 and favorite_count > 500" --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 3. Use Progress Flag for Long Fetches
|
||||
```powershell
|
||||
python twitter_cli.py URL --limit 1000 --progress --output data.json --guest
|
||||
python twitter_cli.py URL --limit 1000 --progress --output data.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 4. Check Cursor Availability
|
||||
- If `completed: false` in output → can resume
|
||||
- If `completed: true` → all data fetched
|
||||
- If `cursor: null` → no more data available
|
||||
- If `cursor: null` → no more data available
|
||||
@@ -102,6 +102,20 @@ def _extract_tweet_metadata(data: MutableMapping[str, Any]) -> Dict[str, Any]:
|
||||
"name": meta["author"].get("name"),
|
||||
"nick": meta["author"].get("nick"),
|
||||
}
|
||||
elif isinstance(meta["author"], str):
|
||||
# Handle case where author is just a string (username)
|
||||
meta["author"] = {
|
||||
"id": None,
|
||||
"name": meta["author"],
|
||||
"nick": meta["author"],
|
||||
}
|
||||
else:
|
||||
# Handle None or other types
|
||||
meta["author"] = {
|
||||
"id": None,
|
||||
"name": None,
|
||||
"nick": None,
|
||||
}
|
||||
return meta
|
||||
|
||||
|
||||
@@ -171,7 +185,9 @@ def run_request(
|
||||
for message in extractor:
|
||||
mtype = message[0]
|
||||
if mtype is Message.Directory and request.metadata:
|
||||
metadata.append(_extract_tweet_metadata(message[1]))
|
||||
# Only extract metadata if message[1] is a dict
|
||||
if isinstance(message[1], dict):
|
||||
metadata.append(_extract_tweet_metadata(message[1]))
|
||||
elif mtype is Message.Url:
|
||||
url = message[1]
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"version": "4.1"
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"info": {
|
||||
"productName": "Twitter/X Media Batch Downloader",
|
||||
"productVersion": "4.1"
|
||||
"productVersion": "4.2"
|
||||
},
|
||||
"wailsjsdir": "./frontend",
|
||||
"assetdir": "./frontend/dist",
|
||||
|
||||
Reference in new issue
Block a user