From b0630d9364e5cb318c67165ff766cde261918fe5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 1 Jul 2026 15:24:58 +0200 Subject: [PATCH] After doing some design on some icons --- .../candle-predict/CandlePredictPage.tsx | 35 ++++--- .../components/RecentPredictionsPanel.tsx | 9 +- .../components/StakeWalletBalanceBar.tsx | 8 +- .../src/features/catalog/CatalogAdminPage.tsx | 24 ++--- .../components/DashboardFiltersBar.tsx | 61 +++++-------- prediqo_web/src/features/home/HomePage.tsx | 43 +++------ .../src/features/profile/ProfilePage.tsx | 68 ++++++-------- .../src/features/referral/ReferralPage.tsx | 28 +++--- .../features/security/SecurityAdminPage.tsx | 53 ++++++----- .../features/treasury/TreasuryAdminPage.tsx | 35 +++---- .../src/features/users/UserManagementPage.tsx | 20 ++-- .../src/features/wallet/WalletPage.tsx | 38 ++++---- .../src/shared/components/PageHeader.tsx | 91 +++++++++++++++++++ 13 files changed, 272 insertions(+), 241 deletions(-) create mode 100644 prediqo_web/src/shared/components/PageHeader.tsx diff --git a/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx b/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx index 992d81a0..61efeeb3 100644 --- a/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx +++ b/prediqo_web/src/features/candle-predict/CandlePredictPage.tsx @@ -17,7 +17,6 @@ import { } from '@mui/material'; import ArrowBackRoundedIcon from '@mui/icons-material/ArrowBackRounded'; import CandlestickChartRoundedIcon from '@mui/icons-material/CandlestickChartRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import { useEffect, useMemo, useRef, useState } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import { useTheme } from '@mui/material/styles'; @@ -44,6 +43,7 @@ import { usePaginatedCandleChart } from './hooks/usePaginatedCandleChart'; import type { CandleDirection, StakeAccountKind } from './types'; import { extractGameApiError } from './utils/extractGameApiError'; import { useAuth } from '../../shared/auth/AuthContext'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; const BALANCES_VISIBLE_STORAGE_KEY = 'prediqo-candle-balances-visible'; @@ -484,31 +484,30 @@ export function CandlePredictPage() { return ( - - - - - + + + + } + icon={} + title={ - Candle Predict - + } + subtitle={ + <> Prédisez si la prochaine bougie sera baissière (Short ↓) ou haussière ( Long ↑), puis attendez le résultat de la manche. - - - void refresh()} aria-label="Refresh"> - - - + + } + mb={2.5} + actions={ void refresh()} />} + /> - + Recent predictions - + {total} total · {PREDICTIONS_PAGE_SIZE} per page diff --git a/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx b/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx index 210f301e..22b0acb8 100644 --- a/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx +++ b/prediqo_web/src/features/candle-predict/components/StakeWalletBalanceBar.tsx @@ -106,11 +106,12 @@ export function StakeWalletBalanceBar({ }} > - + Vos portefeuilles de mise @@ -118,6 +119,7 @@ export function StakeWalletBalanceBar({ size="small" onClick={onToggleVisibility} aria-label={balancesVisible ? 'Masquer les soldes' : 'Afficher les soldes'} + sx={{ flexShrink: 0 }} > {balancesVisible ? ( diff --git a/prediqo_web/src/features/catalog/CatalogAdminPage.tsx b/prediqo_web/src/features/catalog/CatalogAdminPage.tsx index a4500a96..6accf90c 100644 --- a/prediqo_web/src/features/catalog/CatalogAdminPage.tsx +++ b/prediqo_web/src/features/catalog/CatalogAdminPage.tsx @@ -28,13 +28,13 @@ import { import AddRoundedIcon from '@mui/icons-material/AddRounded'; import DeleteOutlineRoundedIcon from '@mui/icons-material/DeleteOutlineRounded'; import EditRoundedIcon from '@mui/icons-material/EditRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import CampaignRoundedIcon from '@mui/icons-material/CampaignRounded'; import SportsEsportsRoundedIcon from '@mui/icons-material/SportsEsportsRounded'; import CandlestickChartRoundedIcon from '@mui/icons-material/CandlestickChartRounded'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useMemo, useState } from 'react'; import { api } from '../../shared/services/api'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import type { Advertisement, AdvertisementInput, Game, GameImplementationOption, GameInput } from '../home/types'; import { hasWebImplementation } from '../games/registry'; import { CandlePredictConfigPanel } from './CandlePredictConfigPanel'; @@ -228,23 +228,11 @@ export function CatalogAdminPage() { return ( - - - - Catalog - - - Manage games and dynamic home-page promotions. - - - - - - + } + /> setTab(v)} sx={{ mb: 2 }} variant="scrollable" scrollButtons="auto"> } iconPosition="start" label="Games" /> diff --git a/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx b/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx index 1ebbd060..1c3ff6f6 100644 --- a/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx +++ b/prediqo_web/src/features/dashboard/components/DashboardFiltersBar.tsx @@ -8,10 +8,9 @@ import { Select, Stack, TextField, - Typography, } from '@mui/material'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import FileDownloadRoundedIcon from '@mui/icons-material/FileDownloadRounded'; +import { PageHeader, RefreshIconButton } from '../../../shared/components/PageHeader'; import type { DashboardFilters, DatePreset, GameKey } from '../types'; const DATE_PRESETS: { value: DatePreset; label: string }[] = [ @@ -59,40 +58,30 @@ export function DashboardFiltersBar({ mb: 3, }} > - - - - Dashboard Administrateur - - - Vue analytique de la plateforme — {periodLabel ?? 'période sélectionnée'} - - - - - - - + + + + + } + /> diff --git a/prediqo_web/src/features/home/HomePage.tsx b/prediqo_web/src/features/home/HomePage.tsx index c03726af..ea5c068b 100644 --- a/prediqo_web/src/features/home/HomePage.tsx +++ b/prediqo_web/src/features/home/HomePage.tsx @@ -5,7 +5,6 @@ import { Alert, Box, Chip, - IconButton, Paper, Skeleton, Snackbar, @@ -14,7 +13,6 @@ import { alpha, } from '@mui/material'; import HomeRoundedIcon from '@mui/icons-material/HomeRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import BoltRoundedIcon from '@mui/icons-material/BoltRounded'; import EmojiEventsRoundedIcon from '@mui/icons-material/EmojiEventsRounded'; import GridViewRoundedIcon from '@mui/icons-material/GridViewRounded'; @@ -23,6 +21,7 @@ import { useNavigate } from 'react-router-dom'; import { GameCard } from './components/GameCard'; import { PromoCarousel } from './components/PromoCarousel'; import { PromoStrip } from './components/PromoStrip'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { useGames, useHeroAdvertisements, useStripAdvertisements } from './hooks/useCatalog'; import type { Game } from './types'; @@ -65,33 +64,19 @@ export function HomePage() { return ( - - - - - - Play & Predict - - - - Explore live prediction games, grab limited-time promos, and compete for rewards. - - - - - - + } + title="Play & Predict" + subtitle="Explore live prediction games, grab limited-time promos, and compete for rewards." + mb={2.5} + actions={ + void refreshAll()} + disabled={loading} + /> + } + /> {(gamesQ.isError || heroQ.isError) && ( diff --git a/prediqo_web/src/features/profile/ProfilePage.tsx b/prediqo_web/src/features/profile/ProfilePage.tsx index 889368f9..6e81d397 100644 --- a/prediqo_web/src/features/profile/ProfilePage.tsx +++ b/prediqo_web/src/features/profile/ProfilePage.tsx @@ -11,7 +11,6 @@ import { CardContent, Chip, Divider, - IconButton, Paper, Skeleton, Snackbar, @@ -21,13 +20,13 @@ import { Typography, } from '@mui/material'; import PersonRoundedIcon from '@mui/icons-material/PersonRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import EditRoundedIcon from '@mui/icons-material/EditRounded'; import SecurityRoundedIcon from '@mui/icons-material/SecurityRounded'; import BadgeRoundedIcon from '@mui/icons-material/BadgeRounded'; import dayjs from 'dayjs'; import { useState } from 'react'; import { useAuth } from '../../shared/auth/AuthContext'; +import { PageHeader, PageSectionHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { ProfileEditForm } from './components/ProfileEditForm'; import { ChangePasswordForm } from './components/ChangePasswordForm'; import { TwoFactorPanel } from './components/TwoFactorPanel'; @@ -53,26 +52,19 @@ export function ProfilePage() { return ( - - - - - - Profile - - - - View and manage your personal information and account security. - - - - - - + } + title="Profile" + subtitle="View and manage your personal information and account security." + mb={2.5} + actions={ + void refresh()} + disabled={profileQ.isLoading} + /> + } + /> {profileQ.isError && ( @@ -167,23 +159,21 @@ export function ProfilePage() { > - - - Personal information - - {profile && !editing && ( - - )} - + } + onClick={() => setEditing(true)} + sx={{ flexShrink: 0 }} + > + Edit + + ) : undefined + } + /> {profileQ.isLoading ? ( {Array.from({ length: 5 }).map((_, i) => ( diff --git a/prediqo_web/src/features/referral/ReferralPage.tsx b/prediqo_web/src/features/referral/ReferralPage.tsx index b271dd92..42dea515 100644 --- a/prediqo_web/src/features/referral/ReferralPage.tsx +++ b/prediqo_web/src/features/referral/ReferralPage.tsx @@ -19,7 +19,6 @@ import { } from '@mui/material'; import GroupAddRoundedIcon from '@mui/icons-material/GroupAddRounded'; import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import TableChartRoundedIcon from '@mui/icons-material/TableChartRounded'; import AccountTreeRoundedIcon from '@mui/icons-material/AccountTreeRounded'; import { useState } from 'react'; @@ -29,6 +28,7 @@ import { ReferralTableView } from './components/ReferralTableView'; import { ReferralTreeView } from './components/ReferralTreeView'; import { ReferralCommissionsPanel } from './components/ReferralCommissionsPanel'; import { useReferralCommissions, useReferralDashboard } from './hooks/useReferralDashboard'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; const USDT_DECIMALS = 6; @@ -92,20 +92,18 @@ export function ReferralPage() { return ( - - - - - Referral program - - - Build your network and earn commissions on your referrals' activity. - - - void refreshAll()} disabled={dashQ.isFetching}> - - - + } + title="Referral program" + subtitle="Build your network and earn commissions on your referrals' activity." + actions={ + void refreshAll()} + disabled={dashQ.isFetching} + /> + } + /> {dashQ.isError && Failed to load referral dashboard.} diff --git a/prediqo_web/src/features/security/SecurityAdminPage.tsx b/prediqo_web/src/features/security/SecurityAdminPage.tsx index 39f46abd..634abaf8 100644 --- a/prediqo_web/src/features/security/SecurityAdminPage.tsx +++ b/prediqo_web/src/features/security/SecurityAdminPage.tsx @@ -32,7 +32,6 @@ import { Typography, } from '@mui/material'; import SecurityRoundedIcon from '@mui/icons-material/SecurityRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import PlayArrowRoundedIcon from '@mui/icons-material/PlayArrowRounded'; import DownloadRoundedIcon from '@mui/icons-material/DownloadRounded'; import NotificationsActiveRoundedIcon from '@mui/icons-material/NotificationsActiveRounded'; @@ -40,6 +39,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useState, useEffect } from 'react'; import { useSearchParams } from 'react-router-dom'; import { api } from '../../shared/services/api'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { ScrollableTable } from '../../shared/components/ScrollableTable'; import { humanToRaw } from '../wallet/utils/walletFormat'; @@ -439,51 +439,58 @@ export function SecurityAdminPage() { return ( - - - - Security - - {creditSuccess && ( - setCreditSuccess(null)} sx={{ flex: '1 1 100%' }}> - {creditSuccess} - - )} - + } + title="Security" + actions={ + { + void alertsQ.refetch(); + void notificationsQ.refetch(); + void creditsQ.refetch(); + void tamperEventsQ.refetch(); + }} + /> + } + /> + + {creditSuccess && ( + setCreditSuccess(null)} sx={{ mb: 2 }}> + {creditSuccess} + + )} + + diff --git a/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx b/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx index 42266455..647fefef 100644 --- a/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx +++ b/prediqo_web/src/features/treasury/TreasuryAdminPage.tsx @@ -22,10 +22,10 @@ import { Typography, } from '@mui/material'; import AccountBalanceWalletRoundedIcon from '@mui/icons-material/AccountBalanceWalletRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { useState } from 'react'; import { api } from '../../shared/services/api'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { ScrollableTable } from '../../shared/components/ScrollableTable'; type WalletType = { @@ -142,26 +142,19 @@ export function TreasuryAdminPage() { return ( - - - - Treasury - - - + } + title="Treasury" + actions={ + { + void overviewQ.refetch(); + void sweepsQ.refetch(); + }} + /> + } + /> {overviewQ.isError && ( diff --git a/prediqo_web/src/features/users/UserManagementPage.tsx b/prediqo_web/src/features/users/UserManagementPage.tsx index a92a6242..1925f9ed 100644 --- a/prediqo_web/src/features/users/UserManagementPage.tsx +++ b/prediqo_web/src/features/users/UserManagementPage.tsx @@ -31,7 +31,6 @@ import { Typography, useMediaQuery, } from '@mui/material'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; import ExpandMoreRoundedIcon from '@mui/icons-material/ExpandMoreRounded'; import ExpandLessRoundedIcon from '@mui/icons-material/ExpandLessRounded'; @@ -43,6 +42,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import dayjs from 'dayjs'; import { api } from '../../shared/services/api'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { DataGrid, GridToolbarColumnsButton, @@ -1081,19 +1081,11 @@ export function UserManagementPage() { return ( - - - - Users - - - Advanced user table — filter, sort, select multiple users, and run batch actions. - - - q.refetch()} aria-label="Refresh" size="small"> - - - + void q.refetch()} />} + /> {selectedIds.length > 0 && ( diff --git a/prediqo_web/src/features/wallet/WalletPage.tsx b/prediqo_web/src/features/wallet/WalletPage.tsx index 7014bda4..4e488847 100644 --- a/prediqo_web/src/features/wallet/WalletPage.tsx +++ b/prediqo_web/src/features/wallet/WalletPage.tsx @@ -6,7 +6,6 @@ import { Box, Button, Chip, - IconButton, Paper, Skeleton, Snackbar, @@ -19,10 +18,10 @@ import AccountBalanceWalletRoundedIcon from '@mui/icons-material/AccountBalanceW import CallReceivedRoundedIcon from '@mui/icons-material/CallReceivedRounded'; import SendRoundedIcon from '@mui/icons-material/SendRounded'; import SouthWestRoundedIcon from '@mui/icons-material/SouthWestRounded'; -import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; import { useQuery } from '@tanstack/react-query'; import { useMemo, useState } from 'react'; import { api } from '../../shared/services/api'; +import { PageHeader, RefreshIconButton } from '../../shared/components/PageHeader'; import { BonusWalletCard } from './components/BonusWalletCard'; import { TestWalletCard } from './components/TestWalletCard'; import { MainAssetCard } from './components/MainAssetCard'; @@ -80,26 +79,23 @@ export function WalletPage() { return ( - - - - - - Wallet - - - + } + title="Wallet" + subtitle={ + <> Deposit USDT (TRC20) on TRON to fund your account and play Candle Predict. - - - - - - + + } + mb={2.5} + actions={ + void refreshAll()} + disabled={loading} + /> + } + /> {balancesQ.isError && ( diff --git a/prediqo_web/src/shared/components/PageHeader.tsx b/prediqo_web/src/shared/components/PageHeader.tsx new file mode 100644 index 00000000..92834c48 --- /dev/null +++ b/prediqo_web/src/shared/components/PageHeader.tsx @@ -0,0 +1,91 @@ +import RefreshRoundedIcon from '@mui/icons-material/RefreshRounded'; +import { Box, IconButton, Stack, Typography } from '@mui/material'; +import type { ReactNode } from 'react'; + +export type PageHeaderProps = { + icon?: ReactNode; + title: ReactNode; + subtitle?: ReactNode; + /** Control before the page icon (e.g. back button). */ + leading?: ReactNode; + /** Right-side actions (refresh, export, etc.). */ + actions?: ReactNode; + mb?: number; +}; + +/** Page title row — keeps actions aligned on the right on small screens (Referral-style). */ +export function PageHeader({ icon, title, subtitle, leading, actions, mb = 2 }: PageHeaderProps) { + return ( + + {leading} + {icon} + + {typeof title === 'string' ? ( + + {title} + + ) : ( + title + )} + {subtitle != null && + (typeof subtitle === 'string' ? ( + + {subtitle} + + ) : ( + subtitle + ))} + + {actions != null && ( + + {actions} + + )} + + ); +} + +type RefreshIconButtonProps = { + onClick: () => void; + disabled?: boolean; + label?: string; +}; + +export function RefreshIconButton({ onClick, disabled, label = 'Refresh' }: RefreshIconButtonProps) { + return ( + + + + ); +} + +type PageSectionHeaderProps = { + title: string; + actions?: ReactNode; + mb?: number; +}; + +/** Section title inside a card — title and actions stay on one row when possible. */ +export function PageSectionHeader({ title, actions, mb = 2 }: PageSectionHeaderProps) { + return ( + + + {title} + + {actions != null && {actions}} + + ); +}