Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Support): user profile link #328

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/src/components/support/StaffDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const StaffDashboard = () => {

useEffect(() => {
setActivePage(1); // Reset to first page when itemsPerPage changes
}, [itemsPerPage])
}, [itemsPerPage]);

async function getOpenTickets({
page,
Expand Down Expand Up @@ -172,7 +172,7 @@ const StaffDashboard = () => {
return {
totalOpenTickets: res.data.metrics.totalOpenTickets ?? 0,
lastSevenTicketCount: res.data.metrics.lastSevenTicketCount ?? 0,
avgDaysToClose: avgDays.toPrecision(1) ?? "0",
avgDaysToClose: Math.floor(avgDays).toString() ?? "0",
};
} catch (err) {
handleGlobalError(err);
Expand Down Expand Up @@ -262,6 +262,7 @@ const StaffDashboard = () => {
size="tiny"
onClick={() => setShowSettingsModal(true)}
basic
className="ml-2"
>
<Icon name="settings" />
Support Center Settings
Expand All @@ -275,12 +276,12 @@ const StaffDashboard = () => {
title="Open/In Progress Tickets"
/>
<DashboardMetric
metric={supportMetrics?.avgDaysToClose?.toString() ?? 0 + " days"}
metric={(supportMetrics?.avgDaysToClose?.toString() ?? 0) + " days"}
title="Average Time to Resolution"
/>
<DashboardMetric
metric={supportMetrics?.lastSevenTicketCount?.toString() ?? "0"}
title="Total Tickets Past 7 Days"
title="New Tickets Past 7 Days"
/>
</div>
<div className="mt-12">
Expand Down
9 changes: 5 additions & 4 deletions client/src/components/support/TicketDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ const TicketDetails: React.FC<TicketDetailsProps> = ({ ticket }) => {
basic
color="green"
size="mini"
onClick={() =>
onClick={() => {
if (!ticket.user?.centralID) return;
window.open(
`/controlpanel/libreone/users?user_id=${ticket?.user?.uuid}`,
`/controlpanel/libreone/users?user_id=${ticket?.user?.centralID}`,
"_blank"
)
}
);
}}
>
Authenticated
</Button>
Expand Down
4 changes: 4 additions & 0 deletions client/src/types/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ export type AuthorizedApp = {
infoURL: string;
icon: string;
};

export type UserWCentralID = User & {
centralID?: string;
};
3 changes: 2 additions & 1 deletion client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
ProjectModuleConfig,
ProjectModuleSettings,
} from "./Project";
import { User, Account, AuthorizedApp } from "./User";
import { User, Account, AuthorizedApp, UserWCentralID } from "./User";
import { Homework, AdaptAssignment } from "./Homework";
import {
AccountRequest,
Expand Down Expand Up @@ -184,6 +184,7 @@ export type {
User,
Account,
AuthorizedApp,
UserWCentralID,
Homework,
AdaptAssignment,
AccountRequest,
Expand Down
6 changes: 3 additions & 3 deletions client/src/types/support.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from "./User";
import { User, UserWCentralID } from "./User";

export type SupportTicketGuest = {
firstName: string;
Expand All @@ -18,8 +18,8 @@ export type SupportTicket = {
category: string;
capturedURL?: string;
assignedUUIDs?: string[]; // User uuids
assignedUsers?: User[];
user?: User;
assignedUsers?: UserWCentralID[];
user?: UserWCentralID;
guest?: SupportTicketGuest;
timeOpened: string;
timeClosed?: string;
Expand Down
Loading