Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanjnelson committed Dec 12, 2023

Verified

This commit was signed with the committer’s verified signature.
JonasKunz Jonas Kunz
2 parents d53dbf8 + 015f35f commit 24c9b54
Showing 21 changed files with 873 additions and 468 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -179,7 +179,7 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/types": "^5.62.0",
"aws-sdk": "npm:2.1372.0",
"aws-sdk": "2.1372.0",
"babel-loader": "^8.3.0",
"babel-plugin-transform-imports": "^2.0.0",
"babel-plugin-transform-rename-import": "^2.3.0",
35 changes: 35 additions & 0 deletions src/components/ActionableSection/ActionableSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Box, Divider, Skeleton, Stack, Typography } from '@mui/material';
import { ReactNode } from 'react';
import { ChildrenProp, StyleProps } from '~/common';

interface ActionableSectionProps extends StyleProps, ChildrenProp {
title?: ReactNode;
action?: ReactNode;
loading?: boolean;
}

export const ActionableSection = ({
loading,
title,
action,
children,
...rest
}: ActionableSectionProps) => (
<Box component="section" {...rest}>
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
p: 1,
}}
>
<Typography variant="h3">
{!loading ? title : <Skeleton width="120px" />}
</Typography>
{action}
</Box>
<Divider />
<Stack p={2}>{children}</Stack>
</Box>
);
1 change: 1 addition & 0 deletions src/components/ActionableSection/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ActionableSection';
2 changes: 1 addition & 1 deletion src/components/PeriodicReports/ReportLabel.tsx
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ export const getReportLabel = (report?: Report) => {

if (!start || !end) return null;
return +start === +end
? 'Final'
? 'Additional Updates'
: start.hasSame(end, 'month')
? start.toFormat('LLLL yyyy')
: `Q${start.fiscalQuarter} FY${start.fiscalYear}`;
80 changes: 80 additions & 0 deletions src/components/posts/PostListItemCard/PostListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { MoreVert } from '@mui/icons-material';
import { IconButton, MenuProps, Stack, Typography } from '@mui/material';
import { useState } from 'react';
import { canEditAny, StyleProps } from '~/common';
import { useDialog } from '../../Dialog';
import { FormattedDateTime } from '../../Formatters';
import { DeletePost } from '../DeletePost';
import { EditPost } from '../EditPost';
import { PostableIdFragment } from '../PostableId.graphql';
import { PostListItemCardFragment } from './PostListItemCard.graphql';
import { PostListItemMenu } from './PostListItemMenu';

interface PostListItemCardProps extends StyleProps {
parent: PostableIdFragment;
post: PostListItemCardFragment;
includeMembership?: boolean;
}

export const PostListItem = ({
parent,
post,
includeMembership = false,
...rest
}: PostListItemCardProps) => {
const [actionsAnchor, setActionsAnchor] = useState<MenuProps['anchorEl']>();
const [editState, editPost] = useDialog();
const [deleteState, deletePost] = useDialog();
const editable = canEditAny(post);

return (
<Stack direction="column" spacing={1} {...rest}>
<Stack
direction="row"
spacing={2}
justifyContent="space-between"
alignItems="flex-start"
>
<Stack
direction="column"
justifyContent="center"
spacing={0.5}
flex={1}
>
<Typography variant="body2" color="textSecondary">
{post.creator.value?.fullName}
</Typography>
<Typography variant="body2" color="textSecondary">
<FormattedDateTime date={post.createdAt} />
</Typography>
</Stack>
{editable && (
<IconButton onClick={(e) => setActionsAnchor(e.currentTarget)}>
<MoreVert />
</IconButton>
)}
</Stack>
<Typography variant="h4">{post.body.value}</Typography>

<PostListItemMenu
anchorEl={actionsAnchor}
open={Boolean(actionsAnchor)}
onClose={() => setActionsAnchor(null)}
onEdit={() => {
editPost();
setActionsAnchor(null);
}}
onDelete={() => {
deletePost();
setActionsAnchor(null);
}}
/>
<EditPost
includeMembership={includeMembership}
post={post}
{...editState}
/>
<DeletePost parent={parent} post={post} {...deleteState} />
</Stack>
);
};
1 change: 1 addition & 0 deletions src/components/posts/PostListItemCard/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './PostListItemCard';
export * from './PostListItem';
91 changes: 0 additions & 91 deletions src/scenes/Partners/Detail/AddressCard.tsx

This file was deleted.

Loading

0 comments on commit 24c9b54

Please sign in to comment.