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

feat: tup-414 help users "View all …" #317

Merged
merged 16 commits into from
Oct 5, 2023
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
4 changes: 2 additions & 2 deletions apps/tup-ui/src/pages/Dashboard/Dashboard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
display: grid;
gap: 25px;
grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas:
grid-template-rows: auto 1fr;
grid-template-areas:
Comment on lines -47 to +48
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix an unrelated Dashboard layout bug that I am sneaking in, because it has been a bane to the designers but I see how easy it has become to fix.

"projects"
"tickets";

Expand Down
6 changes: 4 additions & 2 deletions libs/tup-components/src/news/UserNews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
} from '@tacc/core-components';
import styles from './UserNews.module.css';

const NEWS_DASHBOARD_DISPLAY_LIMIT = 3;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved limit to a constant1 and lowered it.

Footnotes

  1. Just like in libs/tup-components/src/tickets/TicketsTable.tsx.


const formatDate = (datestring: string): string => {
const date = new Date(datestring);
return date.toLocaleDateString('en-US', {
Expand All @@ -27,13 +29,13 @@ const ViewAllUpdates = () => (
target="_blank"
rel="noopener noreferrer"
>
View All Updates
View all Updates
</a>
);

const UserNews: React.FC = () => {
const { data, isLoading } = useUserNews();
const maxItems = 5;
const maxItems = NEWS_DASHBOARD_DISPLAY_LIMIT;

if (isLoading) return <LoadingSpinner />;
return (
Expand Down
10 changes: 7 additions & 3 deletions libs/tup-components/src/projects/ProjectsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ProjectsAllocations, useProjects } from '@tacc/tup-hooks';
import { Link } from 'react-router-dom';
import { EmptyTablePlaceholder } from '../utils';

const PROJECTS_DASHBOARD_DISPLAY_LIMIT = 7;

const allocationDisplay = (allocations: ProjectsAllocations[]) => {
return allocations.length
? Array.from(
Expand All @@ -18,9 +20,11 @@ const allocationDisplay = (allocations: ProjectsAllocations[]) => {

export const ProjectsTable: React.FC = () => {
const { data, isLoading, error } = useProjects();
const projectData = data?.filter((prj) =>
prj.allocations?.some((alloc) => alloc.status === 'Active')
);
const projectData = data
?.filter((prj) =>
prj.allocations?.some((alloc) => alloc.status === 'Active')
)
.slice(0, PROJECTS_DASHBOARD_DISPLAY_LIMIT);
Comment on lines +23 to +27
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added constant1 and used it to limit projects shown (cuz this table already has a "View all …" link).

Footnotes

  1. Just like in libs/tup-components/src/tickets/TicketsTable.tsx.


if (isLoading) {
return <LoadingSpinner />;
Expand Down
4 changes: 4 additions & 0 deletions libs/tup-components/src/tickets/TicketsDashboard.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.viewall-action {
margin-left: auto;
margin-right: 1em;
}
16 changes: 12 additions & 4 deletions libs/tup-components/src/tickets/TicketsDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { SectionTableWrapper } from '@tacc/core-components';
import React from 'react';
import { Link } from 'react-router-dom';
import { SectionTableWrapper } from '@tacc/core-components';
import TicketCreateModal from './TicketCreateModal';
import { TicketsTable } from './TicketsTable';

import styles from './TicketsDashboard.module.css';

const TicketsDashboard: React.FC = () => {
return (
<SectionTableWrapper
header="My Tickets"
headerActions={
<TicketCreateModal display="secondary" size="small">
+ New Ticket
</TicketCreateModal>
<>
<Link to="/tickets" className={styles['viewall-action']}>
View all Tickets
</Link>
Comment on lines +15 to +17
Copy link
Member Author

@wesleyboar wesleyboar Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to "View all Tickets".

<TicketCreateModal display="secondary" size="small">
+ New Ticket
</TicketCreateModal>
</>
}
contentShouldScroll
>
Expand Down
2 changes: 1 addition & 1 deletion libs/tup-components/src/tickets/TicketsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import './TicketsTable.global.css';
import { formatDate } from '../utils/timeFormat';
import { EmptyTablePlaceholder } from '../utils';

const TICKETS_DASHBOARD_DISPLAY_LIMIT = 12;
const TICKETS_DASHBOARD_DISPLAY_LIMIT = 7;

export const getStatusText = (status: string) => {
switch (status) {
Expand Down