summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/App.css39
-rw-r--r--client/src/App.js57
2 files changed, 60 insertions, 36 deletions
diff --git a/client/src/App.css b/client/src/App.css
index 74b5e05..f27a513 100644
--- a/client/src/App.css
+++ b/client/src/App.css
@@ -2,37 +2,30 @@
text-align: center;
}
-.App-logo {
- height: 40vmin;
- pointer-events: none;
+.App-header {
+ background-color: #282c34;
+ padding: 20px;
+ color: white;
}
-@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-spin infinite 20s linear;
- }
+.App-title {
+ font-size: 1.5rem; /* Smaller heading */
}
-.App-header {
- background-color: #282c34;
- min-height: 100vh;
+.downloaded-content {
display: flex;
- flex-direction: column;
- align-items: center;
+ flex-wrap: wrap;
justify-content: center;
- font-size: calc(10px + 2vmin);
- color: white;
}
-.App-link {
- color: #61dafb;
+.file-item {
+ margin: 10px;
}
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
+video, img {
+ max-width: 300px;
+ max-height: 300px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ padding: 5px;
}
diff --git a/client/src/App.js b/client/src/App.js
index 3784575..eaeca2c 100644
--- a/client/src/App.js
+++ b/client/src/App.js
@@ -1,22 +1,53 @@
-import logo from './logo.svg';
+import React, { useEffect, useState } from 'react';
+import axios from 'axios';
import './App.css';
function App() {
+ const [downloadedFiles, setDownloadedFiles] = useState([]);
+
+ useEffect(() => {
+ fetchDownloadedFiles();
+ const interval = setInterval(() => {
+ fetchDownloadedFiles();
+ }, 60000); // Fetch new content every minute
+ return () => clearInterval(interval);
+ }, []);
+
+ const fetchDownloadedFiles = async () => {
+ try {
+ const response = await axios.get('http://localhost:5001/downloads');
+ setDownloadedFiles(response.data);
+ } catch (error) {
+ console.error('Error fetching downloaded files:', error);
+ }
+ };
+
return (
<div className="App">
<header className="App-header">
- <img src={logo} className="App-logo" alt="logo" />
- <p>
- Edit <code>src/App.js</code> and save to reload.
- </p>
- <a
- className="App-link"
- href="https://reactjs.org"
- target="_blank"
- rel="noopener noreferrer"
- >
- Learn React
- </a>
+ <h1 className="App-title">Insta Local</h1>
+ <div className="downloaded-content">
+ {downloadedFiles.length === 0 ? (
+ <p>No content available</p>
+ ) : (
+ downloadedFiles.map((file, index) => {
+ const fileUrl = `http://localhost:5001/static/${file}`;
+ console.log('Fetching file:', fileUrl); // Log the file URL
+ return (
+ <div key={index} className="file-item">
+ {file.endsWith('.mp4') ? (
+ <video controls>
+ <source src={fileUrl} type="video/mp4" />
+ Your browser does not support the video tag.
+ </video>
+ ) : (
+ <img src={fileUrl} alt={file} />
+ )}
+ </div>
+ );
+ })
+ )}
+ </div>
</header>
</div>
);