Skip to content

Commit

Permalink
変数名修正: getXXX -> XXX
Browse files Browse the repository at this point in the history
  • Loading branch information
takecchi committed Dec 20, 2023
1 parent 16bb25b commit 796f23b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const StyledButton = styled(IconButton)`
`;

export default function MobileOpenPostDialogButton() {
const [getOpenDialog, setOpenDialog] = useState(false);
const [openDialog, setOpenDialog] = useState(false);

const renderablePaths = ['/home', '/search', '/notifications'];
const renderable = renderablePaths.includes(usePathname() as string);
Expand All @@ -59,7 +59,7 @@ export default function MobileOpenPostDialogButton() {

<PostDialog
fullScreen
open={getOpenDialog}
open={openDialog}
close={() => setOpenDialog(false)}
/>
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const SideMenuAccountButton = ({
userName,
profileAvatarImageUrl,
}: Props) => {
const [getShowAccountMenu, setShowAccountMenu] = useState(false);
const [showAccountMenu, setShowAccountMenu] = useState(false);
const accountMenuRef = useRef(null);

return (
Expand All @@ -106,7 +106,7 @@ const SideMenuAccountButton = ({
</HFlex>

<Menu
open={getShowAccountMenu}
open={showAccountMenu}
onClose={() => setShowAccountMenu(false)}
anchorEl={accountMenuRef.current}
anchorOrigin={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const Label = styled(`span`)`
}
`;
const SideMenuPostButton = () => {
const [getShowPostDialog, setShowPostDialog] = useState(false);
const [showPostDialog, setShowPostDialog] = useState(false);

return (
<>
Expand All @@ -47,7 +47,7 @@ const SideMenuPostButton = () => {
</Wrapper>

<PostDialog
open={getShowPostDialog}
open={showPostDialog}
close={() => setShowPostDialog(false)}
/>
</>
Expand Down
41 changes: 18 additions & 23 deletions src/app/_components/post/PostDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ interface Props {
}

export default function PostDialog({ fullScreen, open, close }: Props) {
const [getContent, setContent] = useState('');
const [getShowConfirmCloseDialog, setShowConfirmCloseDialog] =
useState(false);
const [getErrorMessage, setErrorMesssage] = useState('');
const [getSucceedMessage, setSucceedMessage] = useState('');
const [content, setContent] = useState('');
const [showConfirmCloseDialog, setShowConfirmCloseDialog] = useState(false);
const [errorMessage, setErrorMessage] = useState('');
const [successMessage, setSuccessMessage] = useState('');
const { mutateLatest } = useHomeTimelineImmutable();

// NOTE: 閉じきる前に微妙に空になるのが見えるので
Expand All @@ -64,55 +63,51 @@ export default function PostDialog({ fullScreen, open, close }: Props) {
<Dialog
fullScreen={fullScreen}
open={open}
onClose={() => (getContent.length ? confirmAndClose() : close())}
onClose={() => (content.length ? confirmAndClose() : close())}
>
<StyledDialogTitle>
<HFlex>
<IconButton
onClick={() => (getContent.length ? confirmAndClose() : close())}
onClick={() => (content.length ? confirmAndClose() : close())}
>
<Close />
</IconButton>
</HFlex>
</StyledDialogTitle>

<StyledDialogContent>
<PostForm
getContent={getContent}
setContent={setContent}
focusEditor
/>
<PostForm getContent={content} setContent={setContent} focusEditor />
</StyledDialogContent>

<StyledDialogActions>
<SendPostButton
disabled={!getContent.length}
sendData={{ plainText: getContent }}
disabled={!content.length}
sendData={{ plainText: content }}
onSucceed={() => {
setSucceedMessage('送信しました。');
setSuccessMessage('送信しました。');
clearContent();
void mutateLatest();
close();
}}
onError={(e) => {
// TODO: リリース前に消す?
console.error(e);
setErrorMesssage('送信に失敗しました。');
setErrorMessage('送信に失敗しました。');
}}
/>
</StyledDialogActions>

<Snackbar
open={!!getErrorMessage.length}
onClose={() => setErrorMesssage('')}
open={!!errorMessage.length}
onClose={() => setErrorMessage('')}
autoHideDuration={2_000}
>
<Alert severity="error">{getErrorMessage}</Alert>
<Alert severity="error">{errorMessage}</Alert>
</Snackbar>
</Dialog>

<ConfirmClosePostDialogDialog
open={getShowConfirmCloseDialog}
open={showConfirmCloseDialog}
close={() => setShowConfirmCloseDialog(false)}
actions={[
{
Expand All @@ -127,11 +122,11 @@ export default function PostDialog({ fullScreen, open, close }: Props) {
/>

<Snackbar
open={!!getSucceedMessage.length}
onClose={() => setSucceedMessage('')}
open={!!successMessage.length}
onClose={() => setSuccessMessage('')}
autoHideDuration={2_000}
>
<Alert severity="success">{getSucceedMessage}</Alert>
<Alert severity="success">{successMessage}</Alert>
</Snackbar>
</Box>
);
Expand Down

0 comments on commit 796f23b

Please sign in to comment.