feat: Add role-based email limit exemption for emperors

This commit is contained in:
beilunyang
2025-02-27 23:59:36 +08:00
parent 59671091b6
commit f86d944c25
4 changed files with 58 additions and 15 deletions
+8 -1
View File
@@ -19,6 +19,8 @@ import {
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { ROLES } from "@/lib/permissions"
import { useUserRole } from "@/hooks/use-user-role"
interface Email {
id: string
@@ -40,6 +42,7 @@ interface EmailResponse {
export function EmailList({ onEmailSelect, selectedEmailId }: EmailListProps) {
const { data: session } = useSession()
const { role } = useUserRole()
const [emails, setEmails] = useState<Email[]>([])
const [loading, setLoading] = useState(true)
const [refreshing, setRefreshing] = useState(false)
@@ -167,7 +170,11 @@ export function EmailList({ onEmailSelect, selectedEmailId }: EmailListProps) {
<RefreshCw className="h-4 w-4" />
</Button>
<span className="text-xs text-gray-500">
{total}/{EMAIL_CONFIG.MAX_ACTIVE_EMAILS}
{role === ROLES.EMPEROR ? (
`${total}/∞ 个邮箱`
) : (
`${total}/${EMAIL_CONFIG.MAX_ACTIVE_EMAILS} 个邮箱`
)}
</span>
</div>
<CreateDialog onEmailCreated={handleRefresh} />