mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat: add blacklisted user blocking screen
Add BlacklistedScreen component, blocking store type, API error interceptor, and i18n translations (ru, en, zh, fa) for blacklisted users.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
export type BlockingType = 'maintenance' | 'channel_subscription' | null;
|
||||
export type BlockingType = 'maintenance' | 'channel_subscription' | 'blacklisted' | null;
|
||||
|
||||
interface MaintenanceInfo {
|
||||
message: string;
|
||||
@@ -12,13 +12,19 @@ interface ChannelSubscriptionInfo {
|
||||
channel_link?: string;
|
||||
}
|
||||
|
||||
interface BlacklistedInfo {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface BlockingState {
|
||||
blockingType: BlockingType;
|
||||
maintenanceInfo: MaintenanceInfo | null;
|
||||
channelInfo: ChannelSubscriptionInfo | null;
|
||||
blacklistedInfo: BlacklistedInfo | null;
|
||||
|
||||
setMaintenance: (info: MaintenanceInfo) => void;
|
||||
setChannelSubscription: (info: ChannelSubscriptionInfo) => void;
|
||||
setBlacklisted: (info: BlacklistedInfo) => void;
|
||||
clearBlocking: () => void;
|
||||
}
|
||||
|
||||
@@ -26,12 +32,14 @@ export const useBlockingStore = create<BlockingState>((set) => ({
|
||||
blockingType: null,
|
||||
maintenanceInfo: null,
|
||||
channelInfo: null,
|
||||
blacklistedInfo: null,
|
||||
|
||||
setMaintenance: (info) =>
|
||||
set({
|
||||
blockingType: 'maintenance',
|
||||
maintenanceInfo: info,
|
||||
channelInfo: null,
|
||||
blacklistedInfo: null,
|
||||
}),
|
||||
|
||||
setChannelSubscription: (info) =>
|
||||
@@ -39,6 +47,15 @@ export const useBlockingStore = create<BlockingState>((set) => ({
|
||||
blockingType: 'channel_subscription',
|
||||
channelInfo: info,
|
||||
maintenanceInfo: null,
|
||||
blacklistedInfo: null,
|
||||
}),
|
||||
|
||||
setBlacklisted: (info) =>
|
||||
set({
|
||||
blockingType: 'blacklisted',
|
||||
blacklistedInfo: info,
|
||||
maintenanceInfo: null,
|
||||
channelInfo: null,
|
||||
}),
|
||||
|
||||
clearBlocking: () =>
|
||||
@@ -46,5 +63,6 @@ export const useBlockingStore = create<BlockingState>((set) => ({
|
||||
blockingType: null,
|
||||
maintenanceInfo: null,
|
||||
channelInfo: null,
|
||||
blacklistedInfo: null,
|
||||
}),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user