Skip to content

Commit

Permalink
Merge branch 'main' into RH/create-chartstring-in-folder-id
Browse files Browse the repository at this point in the history
  • Loading branch information
laholstege committed Jan 17, 2024
2 parents 1744fd7 + fa64223 commit 896ba3f
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const EntryEditButtons = (props: Props) => {
className="flex-fill"
disabled={removeMutation.isLoading}
onClick={remove}
noMargin={true}
margin={false}
>
<FontAwesomeIcon icon={faTrash} />
Remove
Expand Down
4 changes: 2 additions & 2 deletions Finjector.Web/ClientApp/src/components/Entry/FolderSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ interface FolderSearchProps {
currentlySavedInFolderId?: number;
}

const FolderSearch = ({
const FolderSearch: React.FC<FolderSearchProps> = ({
updateFolderId,
selectedFolderId,
disabled,
currentlySavedInFolderId,
}: FolderSearchProps) => {
}) => {
const [selectedFolder, setSelectedFolder] = useState<Folder | undefined>();

const typeaheadRef = useRef<any>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,16 @@ const SaveAndUseButton = (props: Props) => {
};

return (
// <div className="row">
// <div className="col-md-6">
<div className="d-flex">
<FinjectorButton
className="flex-fill"
disabled={saveMutation.isLoading || !savedChart.name}
onClick={saveAndUse}
margin={false}
>
{isInPopup ? "Save and use" : "Save"}
</FinjectorButton>
</div>
// </div>
// </div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps> = ({
id={`copy-button-${id}`}
onClick={handleCopy}
onMouseEnter={onHover}
noMargin={true}
margin={false}
{...props}
>
<FontAwesomeIcon icon={faCopy} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ interface FinjectorButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
children: React.ReactNode;
to?: string; // when using it as a Link
noMargin?: boolean; // removes the margin on the button
margin?: boolean; // removes the margin on the button
}

const FinjectorButton: React.FC<FinjectorButtonProps> = ({
children,
className,
to,
color,
noMargin,
margin = true,
...props
}) => {
// default className is "btn btn-new ms-1"
// if color is provided, it will add "btn-{color}" e.g. "btn-warning"
// if noMargin is true, it will remove "ms-1"
// if margin is false, it will remove "ms-2"
// if className is provided, it will add that className
const classNameString = `btn btn-new ${className ?? ""}${
!!color ? ` btn-${color}` : ""
}${noMargin ? "" : " ms-2"}`;
}${margin ? " ms-2" : ""}`;

if (!!to) {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function FormComponent(props: Props) {
</div>
</div>

<FinjectorButton type="submit" noMargin={true} disabled={loading}>
<FinjectorButton type="submit" margin={false} disabled={loading}>
{props.buttonText(loading)}
</FinjectorButton>
</form>
Expand Down
2 changes: 1 addition & 1 deletion Finjector.Web/ClientApp/src/pages/Paste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Paste = () => {
className="btn btn-primary"
disabled={error !== "" || coa === ""}
onClick={() => navigate(`/entry/${coa}`)}
noMargin={true}
margin={false}
>
NEXT
</FinjectorButton>
Expand Down
1 change: 1 addition & 0 deletions Finjector.Web/Controllers/ChartsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public async Task<IActionResult> AllCharts()
var charts = await _dbContext.Coas.Include(c => c.Folder).ThenInclude(f => f.Team).Where(c =>
c.Folder.FolderPermissions.Any(fp => fp.User.Iam == iamId) ||
c.Folder.Team.TeamPermissions.Any(tp => tp.User.Iam == iamId))
.OrderBy(a => a.Name)
.ToListAsync();


Expand Down
2 changes: 1 addition & 1 deletion Finjector.Web/Controllers/FolderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task<IActionResult> Get(int id)
.AsSplitQuery()
.SingleOrDefaultAsync(f => f.Id == id);

var charts = await _dbContext.Coas.Where(c => c.FolderId == id).ToListAsync();
var charts = await _dbContext.Coas.Where(c => c.FolderId == id).OrderBy(a => a.Name).ToListAsync();

return Ok(new { folder, charts });
}
Expand Down

0 comments on commit 896ba3f

Please sign in to comment.