diff --git a/.env b/.env new file mode 100644 index 00000000..491f1304 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +REACT_APP_COMMIT_REF=$COMMIT_REF \ No newline at end of file diff --git a/.gitignore b/.gitignore index 302574d9..d32530b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# scripts/deploy.sh env +.deploy-env + # electron builder binaries /bin diff --git a/package.json b/package.json index 1e8359c5..6fee9988 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "mock-require": "3.0.3", "postcss": "8.4.21", "react": "18.2.0", + "react-confirm-alert": "^3.0.6", "react-content-loader": "6.2.1", "react-dom": "18.2.0", "react-draggable": "4.4.5", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 23744f9f..d7748218 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -6,8 +6,8 @@ cd "$(dirname "$0")" # add env vars -if [ -f ../.env ]; then - export $(echo $(cat ../.env | sed 's/#.*//g'| xargs) | envsubst) +if [ -f ../.deploy-env ]; then + export $(echo $(cat ../.deploy-env | sed 's/#.*//g'| xargs) | envsubst) fi # check creds diff --git a/src/App.js b/src/App.js index 79756c9c..c596dd4f 100644 --- a/src/App.js +++ b/src/App.js @@ -17,7 +17,7 @@ import Pending from './components/views/Pending'; import Subscriptions from './components/views/Subscriptions'; import SubscriptionsCatalog from './components/views/SubscriptionsCatalog'; import Thread from './components/views/Thread'; -import CaptchaModal from './components/CaptchaModal'; +import CaptchaModal from './components/modals/CaptchaModal'; import { importAll } from './components/ImageBanner'; import preloadImages from './utils/preloadImages'; import useError from "./hooks/useError"; diff --git a/src/components/CaptchaModal.jsx b/src/components/modals/CaptchaModal.jsx similarity index 95% rename from src/components/CaptchaModal.jsx rename to src/components/modals/CaptchaModal.jsx index bfe43563..4efc02a4 100644 --- a/src/components/CaptchaModal.jsx +++ b/src/components/modals/CaptchaModal.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState, useRef } from 'react'; -import { StyledModal } from './styled/CaptchaModal.styled'; -import useGeneralStore from '../hooks/stores/useGeneralStore'; +import { StyledModal } from '../styled/modals/CaptchaModal.styled'; +import useGeneralStore from '../../hooks/stores/useGeneralStore'; import Modal from 'react-modal'; import Draggable from 'react-draggable'; @@ -126,6 +126,9 @@ const CaptchaModal = () => { placeholder="TYPE THE CAPTCHA HERE AND PRESS ENTER" ref={responseRef} onKeyDown={handleKeyDown} + onInput={(e) => { + e.target.value = e.target.value.toUpperCase(); + }} autoFocus /> captcha diff --git a/src/components/modals/EditModal.jsx b/src/components/modals/EditModal.jsx new file mode 100644 index 00000000..b7fa6713 --- /dev/null +++ b/src/components/modals/EditModal.jsx @@ -0,0 +1,73 @@ +import React, { useEffect, useRef, useState } from 'react'; +import { StyledModal } from '../styled/modals/ReplyModal.styled'; +import useGeneralStore from '../../hooks/stores/useGeneralStore'; +import Modal from 'react-modal'; +import Draggable from 'react-draggable'; + + +const EditModal = ({ isOpen, closeModal, originalCommentContent }) => { + const { + setEditedComment, + selectedStyle, + } = useGeneralStore(state => state); + + const nodeRef = useRef(null); + const commentRef = useRef(); + + const [isMobile, setIsMobile] = useState(window.innerWidth <= 480); + + + useEffect(() => { + const handleResize = () => setIsMobile(window.innerWidth <= 480); + window.addEventListener('resize', handleResize); + + // Cleanup function + return () => { + window.removeEventListener('resize', handleResize); + }; + }, [setIsMobile]); + + + const handleSaveEdit = () => { + setEditedComment(commentRef.current.value); + closeModal(); + }; + + return ( + + +
+
+ Edit Comment +
+
+
+