-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e7ae79
commit 49747f8
Showing
75 changed files
with
23,667 additions
and
201 deletions.
There are no files selected for viewing
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 @@ | ||
|
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,2 @@ | ||
Holds the UI for creating chat link and chat window. | ||
changes made.... |
Large diffs are not rendered by default.
Oops, something went wrong.
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,54 @@ | ||
{ | ||
"name": "client", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@chat-e2ee/service": "file:../service", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.2.5", | ||
"@types/react": "^18.2.9", | ||
"@types/react-dom": "^18.2.4", | ||
"qrcode.react": "^3.1.0", | ||
"react": "^16.13.1", | ||
"react-bootstrap": "^1.5.2", | ||
"react-dom": "^16.13.1", | ||
"react-icons": "^3.10.0", | ||
"react-router-dom": "^5.2.0", | ||
"react-scripts": "^5.0.1", | ||
"typescript-plugin-css-modules": "^5.0.1" | ||
}, | ||
"devDependencies": { | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.5.0", | ||
"@testing-library/user-event": "^7.2.1", | ||
"@types/react-router-dom": "^5.3.3", | ||
"eslint-plugin-jsx-a11y": "^6.6.1", | ||
"eslint-plugin-promise": "4.1.1", | ||
"eslint-plugin-react": "7.31.11", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"html-webpack-plugin": "^5.5.1", | ||
"typescript": "^4.9.5" | ||
}, | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"test": "react-scripts test", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"proxy": "http://localhost:3001" | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,37 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Web site created using create-react-app" | ||
/> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Chat | end2end encrypted</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root" style="height: 100%;"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
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,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
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,76 @@ | ||
html, body { | ||
margin: 0; | ||
padding: 0; | ||
height: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
height: 100%; | ||
overflow: auto; | ||
background: rgb(242, 242, 242); | ||
} | ||
|
||
body { | ||
-ms-overflow-style: none; /* Internet Explorer 10+ */ | ||
scrollbar-width: none; /* Firefox */ | ||
} | ||
body::-webkit-scrollbar { | ||
display: none; /* Safari and Chrome */ | ||
} | ||
|
||
.defaultMode { | ||
background: #121212; | ||
color: #ffffff; | ||
height: 100%; | ||
} | ||
|
||
.bodyContent { | ||
max-width: 800px; | ||
margin: auto; | ||
height: 98%; | ||
} | ||
|
||
code { | ||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; | ||
} | ||
|
||
@media screen and (max-width: 640px) { | ||
.section--default { | ||
border-radius: 0px; | ||
} | ||
} | ||
|
||
a { | ||
color: white; | ||
} | ||
|
||
.fullWidth { | ||
width: 100%; | ||
} | ||
|
||
.lightMode { | ||
background: #ffff; | ||
color: #000000; | ||
} | ||
|
||
@media only screen and (max-width: 900px) { | ||
.bodyContent { | ||
max-width: 700px; | ||
} | ||
} | ||
|
||
@media only screen and (max-width: 800px) { | ||
.bodyContent { | ||
max-width: 600px; | ||
} | ||
} | ||
|
||
@media only screen and (max-width: 640px) { | ||
.bodyContent { | ||
max-width: 95%; | ||
} | ||
} |
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,16 @@ | ||
import React, { useState, createContext } from "react"; | ||
import { LS } from "./utils/storage"; | ||
|
||
let presetDarkMode = LS.get("theme"); | ||
presetDarkMode = presetDarkMode === null ? true : presetDarkMode; | ||
|
||
export const ThemeContext = createContext(presetDarkMode); | ||
|
||
type ThemeProviderProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const ThemeProvider = ({ children }: ThemeProviderProps) => { | ||
const [darkMode, setDarkMode] = useState(presetDarkMode); | ||
return <ThemeContext.Provider value={[darkMode, setDarkMode]}>{children}</ThemeContext.Provider>; | ||
}; |
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,31 @@ | ||
.button { | ||
padding: 10px 20px; | ||
display: inline-block; | ||
border-radius: 8px; /* Adjusted for more pronounced rounded corners */ | ||
border-color: transparent; | ||
font-size: 16px; | ||
opacity: 1; | ||
font-family: inherit; | ||
transition: 180ms; | ||
cursor: pointer; | ||
} | ||
|
||
.disabled { | ||
pointer-events: none; | ||
background: transparent; | ||
} | ||
|
||
.darkMode { | ||
background: #434343; | ||
color: #fff; | ||
} | ||
|
||
.lightMode { | ||
background: #3cb043; | ||
color: #fff; | ||
} | ||
|
||
.primary { | ||
background: #f97316; | ||
color: #fff; | ||
} |
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,32 @@ | ||
import React, { useContext } from "react"; | ||
import styles from "./Style.module.css"; | ||
import { ThemeContext } from "../../ThemeContext"; | ||
|
||
type ButtonProps = { | ||
label: string; | ||
type: string; | ||
disabled?: boolean; | ||
onClick: (event: React.MouseEvent<HTMLDivElement>) => void; | ||
}; | ||
|
||
const Button = (props: ButtonProps) => { | ||
const { label, type = "primary", disabled = false, onClick } = props; | ||
|
||
const [darkMode] = useContext(ThemeContext); | ||
return ( | ||
<div | ||
className={` | ||
${type === "primary" ? styles.primary : styles.secondary} | ||
${styles.button} | ||
${ | ||
disabled === true ? styles.disabled : darkMode === true ? styles.darkMode : styles.lightMode | ||
} | ||
`} | ||
onClick={onClick} | ||
> | ||
{label} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Button; |
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,26 @@ | ||
.deleteButton { | ||
height: 30px; | ||
display: flex; | ||
width: 80px; | ||
font-family: inherit; | ||
font-size: 14px; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
background: #e91e63; | ||
color: #fff; | ||
transition: 180ms; | ||
} | ||
|
||
.lightModeDelete { | ||
background: #3cb043; | ||
color: #fff; | ||
} | ||
|
||
.lightModeDelete:hover { | ||
background: #028a0f !important; | ||
} | ||
|
||
.deleteButton:hover { | ||
background: #ab0b42; | ||
} |
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,25 @@ | ||
import React, { useContext } from "react"; | ||
import { ThemeContext } from "../../ThemeContext"; | ||
import styles from "./Style.module.css"; | ||
|
||
const DeleteChatLink = ({ handleDeleteLink }: any) => { | ||
const [darkMode] = useContext(ThemeContext); | ||
|
||
const deleteHandler = async () => { | ||
if (window.confirm("Delete chat link forever?")) await handleDeleteLink(); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div | ||
className={`${styles.deleteButton} ${!darkMode && styles.lightModeDelete}`} | ||
role="button" | ||
onClick={deleteHandler} | ||
> | ||
Delete | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DeleteChatLink; |
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,45 @@ | ||
import React, { useState } from "react"; | ||
import Modal from "react-bootstrap/Modal"; | ||
|
||
const Image = ({ | ||
src, | ||
maxHeight, | ||
maxWidth | ||
}: { | ||
src: string; | ||
maxHeight: string; | ||
maxWidth: string; | ||
}) => { | ||
const [modalState, setModalState] = useState("none"); | ||
|
||
const imageStyle: React.CSSProperties = { | ||
objectFit: "contain", | ||
maxHeight, | ||
maxWidth | ||
}; | ||
|
||
return ( | ||
<div> | ||
<img | ||
src={src} | ||
style={imageStyle} | ||
alt="" | ||
onClick={() => { | ||
setModalState("block"); | ||
}} | ||
/> | ||
<Modal style={{ height: "100%", width: "100%", display: modalState }} centered> | ||
<img | ||
src={src} | ||
style={imageStyle} | ||
alt="" | ||
onClick={() => { | ||
setModalState("none"); | ||
}} | ||
/> | ||
</Modal> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Image; |
Oops, something went wrong.