Skip to content

Commit 3b8021f

Browse files
committed
Remove Public tab when public tickets are disabled
1 parent e62326c commit 3b8021f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/components/queue/QueueLayout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const QueueLayout = (props: QueueLayoutProps) => {
3838

3939
const [isQueueOpen, setIsQueueOpen] = useState<boolean>();
4040
const [isPendingStageEnabled, setIsPendingStageEnabled] = useState<boolean>();
41+
const [arePublicTicketsEnabled, setArePublicTicketsEnabled] = useState<boolean>();
4142
const changeUserRoleMutation = trpc.user.updateUserRole.useMutation();
4243
const { siteSettings } = useSiteSettings();
4344

@@ -71,6 +72,10 @@ const QueueLayout = (props: QueueLayoutProps) => {
7172
siteSettings.get(SiteSettings.IS_PENDING_STAGE_ENABLED) ===
7273
SiteSettingsValues.TRUE,
7374
);
75+
setArePublicTicketsEnabled(
76+
siteSettings.get(SiteSettings.ARE_PUBLIC_TICKETS_ENABLED) ===
77+
SiteSettingsValues.TRUE,
78+
);
7479
}
7580
}, [siteSettings]);
7681

@@ -90,7 +95,7 @@ const QueueLayout = (props: QueueLayoutProps) => {
9095
}
9196
});
9297

93-
if (isQueueOpen === undefined || isPendingStageEnabled === undefined) {
98+
if (isQueueOpen === undefined || isPendingStageEnabled === undefined || arePublicTicketsEnabled === undefined) {
9499
return <Spinner />;
95100
}
96101

@@ -135,6 +140,7 @@ const QueueLayout = (props: QueueLayoutProps) => {
135140
userId={userId}
136141
userRole={userRole}
137142
isPendingStageEnabled={isPendingStageEnabled}
143+
arePublicTicketsEnabled={arePublicTicketsEnabled}
138144
isQueueOpen={isQueueOpen}
139145
personalQueue={personalQueue}
140146
/>

src/components/queue/TicketQueue.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ interface TicketQueueProps {
2525
userRole: UserRole;
2626
userId: string;
2727
isPendingStageEnabled: boolean;
28+
arePublicTicketsEnabled: boolean;
2829
isQueueOpen: boolean;
2930
personalQueue?: PersonalQueue;
3031
}
@@ -39,6 +40,7 @@ const TicketQueue = (props: TicketQueueProps) => {
3940
const {
4041
userRole,
4142
isPendingStageEnabled,
43+
arePublicTicketsEnabled,
4244
isQueueOpen,
4345
userId,
4446
personalQueue,
@@ -164,7 +166,7 @@ const TicketQueue = (props: TicketQueueProps) => {
164166

165167
const setTabs = (): TabType[] => {
166168
const tabs: TabType[] = [TicketStatus.OPEN, TicketStatus.ASSIGNED];
167-
if (userRole === UserRole.STUDENT) {
169+
if (userRole === UserRole.STUDENT && arePublicTicketsEnabled) {
168170
tabs.unshift("Public");
169171
} else {
170172
if (isPendingStageEnabled) {

0 commit comments

Comments
 (0)