Skip to content

Commit

Permalink
Merge pull request #266 from ucdavis/cyd/importing-flow
Browse files Browse the repository at this point in the history
import page 1
  • Loading branch information
cydoval authored Jan 18, 2024
2 parents 02fec26 + ffb9502 commit 009848e
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 15 deletions.
24 changes: 21 additions & 3 deletions Finjector.Web/ClientApp/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {

import { useUserInfoQuery } from "./queries/userQueries";
import Landing from "./pages/Landing";
import Import from "./pages/Import";
import About from "./pages/About";
import Selected from "./pages/Selected";
import Entry from "./pages/Entry";
Expand Down Expand Up @@ -47,9 +48,18 @@ const router = createBrowserRouter([
path: "/",
element: <Layout />,
children: [
{ index: true, element: <Landing />, handle: { title: "", hideBreadcrumbs: true } },
{
index: true,
element: <Landing />,
handle: { title: "", hideBreadcrumbs: true },
},
{ path: "/example", element: <Example />, handle: { title: "Example" } },
{ path: "/help", element: <About />, handle: { title: "Help" } },
{
path: "/import",
element: <Import />,
handle: { title: "Import", hideBreadcrumbs: true },
},
{
path: "/landing",
element: <RedirectHome />,
Expand Down Expand Up @@ -157,7 +167,11 @@ const router = createBrowserRouter([
{
path: "/entry",
children: [
{ index: true, element: <Entry />, handle: { title: "Entry", hideBreadcrumbs: true } },
{
index: true,
element: <Entry />,
handle: { title: "Entry", hideBreadcrumbs: true },
},
{
path: ":chartSegmentString",
element: <Entry />,
Expand All @@ -175,7 +189,11 @@ const router = createBrowserRouter([
},
],
},
{ path: "/paste", element: <Paste />, handle: { title: "Paste", hideBreadcrumbs: true } },
{
path: "/paste",
element: <Paste />,
handle: { title: "Paste", hideBreadcrumbs: true },
},
{
path: "/selected",
children: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from "react";
import { Folder } from "../../types";
import { faFileLines, faFileExport } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import FinjectorButton from "../Shared/FinjectorButton";

interface ImportListFolderRowProps {
folder: Folder;
}

const ImportListFolderRow = (props: ImportListFolderRowProps) => {
return (
<div className="import-folder-row d-flex align-items-center justify-content-between">
<div className="col-7">
<h3 className="mb-0 ms-2">{props.folder.name}</h3>
</div>
<div className="col-2">
<div className="stat-icon">
<FontAwesomeIcon
title="Chart string count in folder"
icon={faFileLines}
/>
{props.folder.coas.length}
</div>
</div>
<div className="col-3 text-end">
<FinjectorButton className="ms-2 btn-borderless" to={`#`}>
<FontAwesomeIcon icon={faFileExport} />
Import Folder
</FinjectorButton>
</div>
</div>
);
};

export default ImportListFolderRow;
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from "react";
import { TeamGroupedCoas } from "../../types";
import { faFileLines, faFileExport } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import FinjectorButton from "../Shared/FinjectorButton";
import ImportListFolderRow from "./ImportListFolderRow";

interface ImportListTeamRowProps {
teamGroup: TeamGroupedCoas;
}

const ImportListTeamRow = (props: ImportListTeamRowProps) => {
return (
<li className="fin-row saved-list-item">
<div className="fin-info d-flex justify-content-between align-items-center">
<div className="col-7 ms-2">
<h3 className="row-title">{props.teamGroup.team.name}</h3>
</div>
<div className="col-2">
<div className="stat-icon team-coa-counter">
<FontAwesomeIcon
title="Chart string count in team"
icon={faFileLines}
/>
{props.teamGroup.folders.reduce(
(acc, folder) => acc + folder.coas.length,
0
)}
</div>
</div>
<div className="col-3 text-end">
<FinjectorButton to={`#`} className="me-1">
<FontAwesomeIcon icon={faFileExport} />
Import Team
</FinjectorButton>
</div>
</div>
{props.teamGroup.folders.map((folder) => {
return <ImportListFolderRow key={folder.id} folder={folder} />;
})}
</li>
);
};

export default ImportListTeamRow;
8 changes: 3 additions & 5 deletions Finjector.Web/ClientApp/src/components/Teams/FolderList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,15 @@ const FolderList = (props: Props) => {
url={url}
>
<div className="fin-info d-flex justify-content-between align-items-center">
<div className="col-9 ms-2 me-auto">
<div className="row-title">
<h3>{folderInfo.folder.name}</h3>
</div>
<div className="col-8 ms-2 me-auto">
<h3 className="row-title">{folderInfo.folder.name}</h3>
<p className="row-subtitle">
<span style={{ wordWrap: "break-word" }}>
{folderInfo.folder.description}
</span>
</p>
</div>
<div className="col-3 d-flex justify-content-end">
<div className="col-4 d-flex justify-content-end">
<div className="stat-icon">
<FontAwesomeIcon
title="User count in folder"
Expand Down
4 changes: 2 additions & 2 deletions Finjector.Web/ClientApp/src/components/Teams/TeamList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ const ChartList = (props: Props) => {
url={url}
>
<div className="fin-info d-flex justify-content-between align-items-center">
<div className="col-9 ms-2 me-auto">
<div className="col-8 ms-2 me-auto">
<h3 className="row-title">{teamInfo.team.name}</h3>
<p className="row-subtitle">
<span style={{ wordWrap: "break-word" }}>
{teamInfo.team.description}
</span>
</p>
</div>
<div className="col-3 d-flex justify-content-end">
<div className="col-4 d-flex justify-content-end">
<div className="stat-icon">
<FontAwesomeIcon
title="Folder count in team"
Expand Down
25 changes: 25 additions & 0 deletions Finjector.Web/ClientApp/src/pages/Example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ const Example: React.FC = () => {
}
};

const openFinjectorImport = async (e: any) => {
e.preventDefault();

const result = await window.Finjector.findChartSegmentString(
window.location.origin + "/import"
);

if (result.status === "success") {
alert(result.data);
// stick the chart string in the input
//const input = document.getElementById("ccoa-input") as HTMLInputElement;
//input.value = result.data;
}
};

return (
<main className="form-signin w-100 m-auto">
<h1>For Example / Test Use Only</h1>
Expand Down Expand Up @@ -53,6 +68,16 @@ const Example: React.FC = () => {
Example PPM account: K30APSD227-TASK01-APLS002-770000
</small>

<hr />
<button
type="button"
onClick={openFinjectorImport}
className="btn btn-secondary"
id="import"
>
Import
</button>

<hr />
<button className="w-100 btn btn-lg btn-primary" type="submit">
Fake Submit
Expand Down
44 changes: 44 additions & 0 deletions Finjector.Web/ClientApp/src/pages/Import.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";
import { useGetSavedCharts } from "../queries/storedChartQueries";
import ImportListTeamRow from "../components/Import/ImportListTeamRow";

// Main landing screen for popup

const Import = () => {
const [search, setSearch] = React.useState("");

const teamGroups = useGetSavedCharts();

const filterLowercase = search.toLowerCase();
const filteredTeamsInfo = teamGroups.data?.filter((teamInfo) => {
return teamInfo.team.name.toLowerCase().includes(filterLowercase);
});

return (
<div>
<div className="page-title pb-2 mb-3 row justify-content-between align-items-center">
<div className="col-12 col-md-4">
<h1>Import Team or Folder</h1>
</div>
</div>
<div className="mb-3">
<input
type="search"
className="form-control searchbar"
placeholder="Search Teams or Folders to import"
value={search}
onChange={(e) => setSearch(e.target.value)}
/>
</div>
<ul className="list-group">
{filteredTeamsInfo?.map((teamGroup) => {
return (
<ImportListTeamRow key={teamGroup.team.id} teamGroup={teamGroup} />
);
})}
</ul>
</div>
);
};

export default Import;
13 changes: 13 additions & 0 deletions Finjector.Web/ClientApp/src/sass/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
border: 1px solid $danger;
}
}
&.btn-borderless {
border: none;
background-color: rgba(0, 0, 0, 0.001);
&:hover {
background-color: transparentize($primary-color, 0.85);
color: $primary-color;
border: none;
}
}
&:disabled {
color: $tertiary-font;
border-color: $tertiary-font;
Expand Down Expand Up @@ -180,6 +189,7 @@ hr {
box-shadow: 0 0 0 0.1rem transparentize($primary-color, 0.75);
}
.bold-link {
font-size: 1rem;
font-family: $sans-bold;
text-decoration: none;
svg {
Expand Down Expand Up @@ -346,3 +356,6 @@ span.gl-color {
span.ppm-color {
color: $ppm;
}
span.font-reg {
font-family: $sans-reg;
}
20 changes: 15 additions & 5 deletions Finjector.Web/ClientApp/src/sass/_regions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,22 @@
border-top: 1px solid $borders;
padding: 10px 20px;
}
// &:hover {
// .row-link-selected-action {
// text-decoration: underline;
// }
// }
}
.import-folder-row {
background-color: $bg-primary;
border-top: 1px solid $borders;
padding: 10px 0px 10px 20px;
h3 {
font-size: 1rem;
font-family: $sans-bold;
color: $secondary-font;
}
}
.stat-icon {
margin-right: 20px;
color: $secondary-font;
font-family: $sans-bold;
width: 66px;
svg {
margin-right: 4px;
}
Expand Down Expand Up @@ -135,3 +141,7 @@
height: 42px;
margin-top: 2px;
}
.team-coa-counter {
font-size: 1rem;
color: $primary-font;
}

0 comments on commit 009848e

Please sign in to comment.