Skip to content

Commit 4ee517b

Browse files
committed
add description
1 parent 2d03109 commit 4ee517b

File tree

3 files changed

+53
-22
lines changed

3 files changed

+53
-22
lines changed

public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
-->
5252
</body>
5353
<footer id="footer" hidden="true">
54-
This site is created using the awesome <a href="https://ffmpegwasm.netlify.app">ffmpeg.wasm</a> - a WebAssembly port of <a href="https://ffmpeg.org/">FFmpeg</a> (which enables the whole local conversion). <br> and <a href="https://create-react-app.dev">create-react-app</a>
54+
This site is created using the awesome <a href="https://ffmpegwasm.netlify.app">ffmpeg.wasm</a> - a WebAssembly port of <a href="https://ffmpeg.org/">FFmpeg</a> (which enables the whole local conversion). <br> and <a href="https://create-react-app.dev">create-react-app</a><br>
55+
all the source code can be found in my <a href="https://github.com/matan-h/private-convert">github</a>
5556
</footer>
5657
</html>

src/App.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,4 +232,24 @@ footer a {
232232

233233
footer a:hover {
234234
text-decoration: underline;
235+
}
236+
.description-text {
237+
font-size: 1rem;
238+
color: #666;
239+
text-align: center;
240+
/* position: fixed; */
241+
/* z-index: 0; */
242+
/* top:10px */
243+
}
244+
.description-box {
245+
z-index: 0;
246+
position: fixed;
247+
top:10px;
248+
background-color: #38ff0021;
249+
border: 2px solid #999;
250+
border-radius: 10px;
251+
padding: 20px;
252+
margin-top: 20px;
253+
max-width: 400px;
254+
text-align: center;
235255
}

src/App.tsx

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const App: React.FC = () => {
4646
progress: number;
4747
time: number;
4848
}
49-
49+
5050
const onProgress = function (progress_obj: progressOBJ) {
5151
if (progress_obj.progress > 1000) { return } // sometimes happend to ffmpeg.wasm
5252
const progress = progress_obj.progress * 100;
@@ -87,21 +87,21 @@ const App: React.FC = () => {
8787
}
8888
else {
8989
console.log("no ffmpeg instance, using setpostFFmpegInstance")
90-
setpostFFmpegInstance(() => { setCurrentScreen(Screen.PREVIEW);setpostFFmpegInstance(null) })
90+
setpostFFmpegInstance(() => { setCurrentScreen(Screen.PREVIEW); setpostFFmpegInstance(null) })
9191
}
9292
};
9393

9494
const { getRootProps, getInputProps } = useDropzone({
95-
accept: { "image/gif": [], "video/*": [], "audio/*": [], "image/*": []},
95+
accept: { "image/gif": [], "video/*": [], "audio/*": [], "image/*": [] },
9696
onDrop: handleFileUpload,
9797
});
9898

9999
const handleConvert = async () => {
100100
setCurrentScreen(Screen.CONVERTING);
101-
window.addEventListener("popstate", ()=>{;handleReset_reload()})
101+
window.addEventListener("popstate", () => { ; handleReset_reload() })
102102

103103

104-
window.history.pushState({}, "converting", "#converting");
104+
window.history.pushState({}, "converting", "#converting");
105105
// window.removeEventListener('popstate',handleReset);
106106

107107
// console.log(`resetting outputFiles from [${outputFiles}] to []`);
@@ -113,7 +113,7 @@ const App: React.FC = () => {
113113
const mimetype: string = ConvertOptions[output_ext].mimetype; // the first in the list is the default
114114
const newOutputFiles = [];
115115
const verifyFFmpegWorking = () => { // we cannot use progress value here since react save the state, so it always be zero
116-
if (ProgressBarRef.current?.value === 0) { const s = ("ffmpeg not returning any progress in 8 seconds. maybe your browser killed it. if it continue to be on 0%, please reload"); setErrorMessage(s)}
116+
if (ProgressBarRef.current?.value === 0) { const s = ("ffmpeg not returning any progress in 8 seconds. maybe your browser killed it. if it continue to be on 0%, please reload"); setErrorMessage(s) }
117117
}
118118

119119
for (const [i, inputFile] of selectedFiles.entries()) {
@@ -127,8 +127,8 @@ const App: React.FC = () => {
127127
if (mostInputFormat) {
128128
ffmpeg_arguments = mostInputFormat.optional_convert_routes[output_ext]
129129
console.log("ffmpeg arguments:", ffmpeg_arguments)
130-
if (ffmpeg_arguments===undefined){
131-
console.log("mostInputFormat:",mostInputFormat,output_ext);
130+
if (ffmpeg_arguments === undefined) {
131+
console.log("mostInputFormat:", mostInputFormat, output_ext);
132132
}
133133
}
134134

@@ -154,7 +154,7 @@ const App: React.FC = () => {
154154
clearTimeout(it)
155155
newOutputFiles.push(outFile);
156156
}
157-
if (!ffmpegInstance.loaded){
157+
if (!ffmpegInstance.loaded) {
158158
console.log("get ffmpegInstance.loaded=false")
159159
handleReset();
160160
return;
@@ -168,9 +168,9 @@ const App: React.FC = () => {
168168
setErrorMessage(err);
169169
}
170170
};
171-
const handleReset_reload = ()=>{handleReset("true")}
171+
const handleReset_reload = () => { handleReset("true") }
172172

173-
const handleReset = (x:any="false") => {
173+
const handleReset = (x: any = "false") => {
174174
setSelectedFiles([]);
175175
setConversionProgress(0);
176176
setCurrentScreen(Screen.UPLOAD);
@@ -179,24 +179,34 @@ const App: React.FC = () => {
179179
setMostInputFormat(null);
180180
setLogs([]);
181181
setOutputFiles([]);
182-
if (ffmpegInstance && (x==="true")){
182+
if (ffmpegInstance && (x === "true")) {
183183
ffmpegInstance.reload()
184184
}
185-
window.removeEventListener('popstate',handleReset_reload);
185+
window.removeEventListener('popstate', handleReset_reload);
186186
};
187187

188188
function renderScreen() {
189189
switch (currentScreen) {
190190
case Screen.UPLOAD:
191191
return (
192-
<div className="full-screen">
193-
<div className="upload-area" {...getRootProps()}>
194-
<input {...getInputProps()} />
195-
<p className="upload-text">
196-
Drag files here or click here to upload files
197-
</p>
192+
<>
193+
<div className="description-box">
194+
<p className="description-text">
195+
Private Convert is a private (static) website to convert media files privately in your browser.<br></br>
196+
Your files will stay locally on your computer.
197+
{/* <b>**without**</b> be uploaded to our servers. */}
198+
199+
</p></div>
200+
<div className="full-screen">
201+
<div className="upload-area" {...getRootProps()}>
202+
<input {...getInputProps()} />
203+
<p className="upload-text">
204+
Drag files here or click here to upload files
205+
</p>
206+
</div>
207+
<br></br>
198208
</div>
199-
</div>
209+
</>
200210
);
201211

202212
case Screen.PREVIEW:
@@ -390,7 +400,7 @@ const App: React.FC = () => {
390400
value={conversionProgress}
391401
ref={ProgressBarRef}
392402
max={100} />
393-
{conversionProgress !==0 && <span className="progress-text">{conversionProgress.toFixed(2)}%</span>}
403+
{conversionProgress !== 0 && <span className="progress-text">{conversionProgress.toFixed(2)}%</span>}
394404
{errorMessage && <><blockquote className="error-message"><p>{errorMessage}</p></blockquote>
395405
<button
396406
className="action-button reset-button"

0 commit comments

Comments
 (0)