Skip to content

Commit 1cf3e96

Browse files
committed
refactor(content_management): restructure ArchivedTopicsState to include status and additional properties
1 parent a67b062 commit 1cf3e96

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed
Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
part of 'archived_topics_bloc.dart';
22

3-
sealed class ArchivedTopicsState extends Equatable {
4-
const ArchivedTopicsState();
5-
6-
@override
7-
List<Object> get props => [];
3+
/// Represents the status of archived content operations.
4+
enum ArchivedTopicsStatus {
5+
initial,
6+
loading,
7+
success,
8+
failure,
89
}
910

10-
final class ArchivedTopicsInitial extends ArchivedTopicsState {}
11+
/// The state for the archived content feature.
12+
class ArchivedTopicsState extends Equatable {
13+
const ArchivedTopicsState({
14+
this.status = ArchivedTopicsStatus.initial,
15+
this.topics = const [],
16+
this.cursor,
17+
this.hasMore = false,
18+
this.exception,
19+
});
20+
21+
final ArchivedTopicsStatus status;
22+
final List<Topic> topics;
23+
final String? cursor;
24+
final bool hasMore;
25+
final HttpException? exception;
26+
27+
ArchivedTopicsState copyWith({
28+
ArchivedTopicsStatus? status,
29+
List<Topic>? topics,
30+
String? cursor,
31+
bool? hasMore,
32+
HttpException? exception,
33+
}) {
34+
return ArchivedTopicsState(
35+
status: status ?? this.status,
36+
topics: topics ?? this.topics,
37+
cursor: cursor ?? this.cursor,
38+
hasMore: hasMore ?? this.hasMore,
39+
exception: exception ?? this.exception,
40+
);
41+
}
42+
43+
@override
44+
List<Object?> get props => [
45+
status,
46+
topics,
47+
cursor,
48+
hasMore,
49+
exception,
50+
];
51+
}

0 commit comments

Comments
 (0)