mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 01:11:25 +00:00
start work on PWA check
This commit is contained in:
parent
3838da7b16
commit
bc479364b4
BIN
client/public/intro_vid.mp4
Normal file
BIN
client/public/intro_vid.mp4
Normal file
Binary file not shown.
@ -5,10 +5,12 @@ import { getPow } from '../utils/mine';
|
|||||||
import { Event } from 'nostr-tools';
|
import { Event } from 'nostr-tools';
|
||||||
import { subGlobalFeed } from '../utils/subscriptions';
|
import { subGlobalFeed } from '../utils/subscriptions';
|
||||||
import { uniqBy } from '../utils/utils';
|
import { uniqBy } from '../utils/utils';
|
||||||
|
import PWAInstallPopup from './Modals/PWACheckModal';
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const [events, setEvents] = useState<Event[]>([]);
|
const [events, setEvents] = useState<Event[]>([]);
|
||||||
const [filterDifficulty, setFilterDifficulty] = useState(localStorage.getItem('filterDifficulty') || '20');
|
const [filterDifficulty, setFilterDifficulty] = useState(localStorage.getItem('filterDifficulty') || '20');
|
||||||
|
const [inBrowser, setInBrowser] = useState(false)
|
||||||
|
|
||||||
const onEvent = (event: Event) => {
|
const onEvent = (event: Event) => {
|
||||||
setEvents((prevEvents) => [...prevEvents, event]);
|
setEvents((prevEvents) => [...prevEvents, event]);
|
||||||
@ -23,6 +25,13 @@ const Home = () => {
|
|||||||
const { difficulty, filterDifficulty } = customEvent.detail;
|
const { difficulty, filterDifficulty } = customEvent.detail;
|
||||||
setFilterDifficulty(filterDifficulty);
|
setFilterDifficulty(filterDifficulty);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// if ((window.navigator as any).standalone || window.matchMedia('(display-mode: standalone)').matches) {
|
||||||
|
// console.log('App is running in standalone mode.');
|
||||||
|
// } else {
|
||||||
|
// console.log('App is running in a browser.');
|
||||||
|
// setInBrowser(true)
|
||||||
|
// }
|
||||||
|
|
||||||
window.addEventListener('difficultyChanged', handleDifficultyChange);
|
window.addEventListener('difficultyChanged', handleDifficultyChange);
|
||||||
|
|
||||||
@ -56,6 +65,7 @@ const Home = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-black text-white min-h-screen">
|
<main className="bg-black text-white min-h-screen">
|
||||||
|
{/* {inBrowser && <PWAInstallPopup onClose={() => setInBrowser(false)} />} */}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4">
|
||||||
<NewThreadCard />
|
<NewThreadCard />
|
||||||
{filteredAndSortedEvents.map((event, index) => (
|
{filteredAndSortedEvents.map((event, index) => (
|
||||||
|
21
client/src/components/Modals/PWACheckModal.tsx
Normal file
21
client/src/components/Modals/PWACheckModal.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// PWAInstallPopup.tsx
|
||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
|
||||||
|
interface PWAInstallPopupProps {
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PWAInstallPopup: React.FC<PWAInstallPopupProps> = ({ onClose }) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="fixed inset-0 flex items-center justify-center z-50">
|
||||||
|
<div className="bg-white p-4 rounded shadow-lg">
|
||||||
|
<h1 className="text-lg font-semibold mb-2">Install Our PWA</h1>
|
||||||
|
<p className="mb-4">Click "Install" to add this app to your home screen and enjoy a full-screen experience!</p>
|
||||||
|
<button className="bg-gray-200 px-4 py-2 rounded" onClick={onClose}>Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PWAInstallPopup;
|
@ -17,11 +17,11 @@ const ContentPreview = ({ key, comment }: { key: string, comment: string }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const findUrl = comment.match(/\bhttps?:\/\/\S+/gi);
|
// const findUrl = comment.match(/\bhttps?:\/\/\S+/gi);
|
||||||
if (findUrl && findUrl.length > 0) {
|
// if (findUrl && findUrl.length > 0) {
|
||||||
setUrl(findUrl[0])
|
// setUrl(findUrl[0])
|
||||||
setFinalComment(finalComment.replace(findUrl[0], '').trim())
|
// setFinalComment(finalComment.replace(findUrl[0], '').trim())
|
||||||
}
|
// }
|
||||||
|
|
||||||
const match = comment.match(/\bnostr:([a-z0-9]+)/i);
|
const match = comment.match(/\bnostr:([a-z0-9]+)/i);
|
||||||
const nostrQuoteID = match && match[1];
|
const nostrQuoteID = match && match[1];
|
||||||
|
@ -20,10 +20,6 @@ const Settings = () => {
|
|||||||
window.dispatchEvent(event);
|
window.dispatchEvent(event);
|
||||||
};
|
};
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// addRelay('wss://powrelay.xyz');
|
|
||||||
// }, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="settings-page bg-black text-white p-8 flex flex-col h-full">
|
<div className="settings-page bg-black text-white p-8 flex flex-col h-full">
|
||||||
<h1 className="text-lg font-semibold mb-4">Settings</h1>
|
<h1 className="text-lg font-semibold mb-4">Settings</h1>
|
||||||
|
Loading…
Reference in New Issue
Block a user