-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CP-2191] I want only supported files to be uploaded (#1393)
- Loading branch information
1 parent
8ca1e54
commit 06aa8d0
Showing
12 changed files
with
164 additions
and
19 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/app/src/__deprecated__/renderer/locales/default/pl-PL.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"component.collectingDataModalBody": "I agree on sending anonymized data to Mudita" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
...es/app/src/files-manager/components/invalid-files-modal/invalid-files-modal.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* Copyright (c) Mudita sp. z o.o. All rights reserved. | ||
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md | ||
*/ | ||
|
||
import { defineMessages } from "react-intl" | ||
import { FunctionComponent } from "App/__deprecated__/renderer/types/function-component.interface" | ||
import { useDispatch, useSelector } from "react-redux" | ||
import { getInvalidFiles } from "App/files-manager/selectors/get-invalid-files.selector" | ||
import { | ||
ModalContent, | ||
ModalDialog, | ||
RoundIconWrapper, | ||
} from "App/ui/components/modal-dialog" | ||
import React from "react" | ||
import { ModalSize } from "App/__deprecated__/renderer/components/core/modal/modal.interface" | ||
import { intl } from "App/__deprecated__/renderer/utils/intl" | ||
import Icon from "App/__deprecated__/renderer/components/core/icon/icon.component" | ||
import { IconType } from "App/__deprecated__/renderer/components/core/icon/icon-type" | ||
import Text, { | ||
TextDisplayStyle, | ||
} from "App/__deprecated__/renderer/components/core/text/text.component" | ||
import { resetUploadingState } from "App/files-manager/actions" | ||
import styled from "styled-components" | ||
import { | ||
fontWeight, | ||
textColor, | ||
} from "App/__deprecated__/renderer/styles/theming/theme-getters" | ||
import { ipcRenderer } from "electron-better-ipc" | ||
import { HelpActions } from "App/__deprecated__/common/enums/help-actions.enum" | ||
|
||
const messages = defineMessages({ | ||
title: { | ||
id: "module.filesManager.invalidFiledModalTitle", | ||
}, | ||
filesInfo: { | ||
id: "module.filesManager.invalidFiledModalFilesInfo", | ||
}, | ||
helpInfo: { | ||
id: "module.filesManager.invalidFiledModalHelpInfo", | ||
}, | ||
}) | ||
|
||
const StyledLink = styled.a` | ||
text-decoration: underline; | ||
cursor: pointer; | ||
font-size: 1.4rem; | ||
font-weight: ${fontWeight("default")}; | ||
color: ${textColor("action")}; | ||
` | ||
const StyledModalContent = styled(ModalContent)` | ||
p { | ||
text-align: left; | ||
} | ||
` | ||
|
||
export const InvalidFilesModal: FunctionComponent = ({ ...props }) => { | ||
const invalidFiles = useSelector(getInvalidFiles) | ||
const openHelpWindow = () => ipcRenderer.callMain(HelpActions.OpenWindow) | ||
|
||
const dispatch = useDispatch() | ||
return ( | ||
<ModalDialog | ||
size={ModalSize.Small} | ||
title={intl.formatMessage(messages.title)} | ||
open={!!invalidFiles.length} | ||
closeButton | ||
onCloseButton={() => { | ||
dispatch(resetUploadingState()) | ||
}} | ||
{...props} | ||
> | ||
<StyledModalContent> | ||
<RoundIconWrapper> | ||
<Icon type={IconType.Info} width={3.2} /> | ||
</RoundIconWrapper> | ||
<Text | ||
displayStyle={TextDisplayStyle.Paragraph4} | ||
color="secondary" | ||
message={messages.filesInfo} | ||
/> | ||
<Text | ||
displayStyle={TextDisplayStyle.Paragraph4} | ||
color="secondary" | ||
message={{ | ||
...messages.helpInfo, | ||
values: { | ||
link: ( | ||
<StyledLink onClick={openHelpWindow}>help pages</StyledLink> | ||
), | ||
}, | ||
}} | ||
/> | ||
</StyledModalContent> | ||
</ModalDialog> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/app/src/files-manager/selectors/get-invalid-files.selector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) Mudita sp. z o.o. All rights reserved. | ||
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md | ||
*/ | ||
|
||
import { createSelector } from "@reduxjs/toolkit" | ||
import { getFilesManager } from "App/files-manager/selectors/get-files-manager.selector" | ||
|
||
export const getInvalidFiles = createSelector( | ||
getFilesManager, | ||
(filesManager): string[] => { | ||
return filesManager.invalidFiles | ||
} | ||
) |