import * as React from 'react';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import Link from '@mui/material/Link';
import ProTip from './ProTip';
import {useState} from "react";
function Copyright() {
return (
{'Copyright © '}
Your Website
{' '}
{new Date().getFullYear()}
{'.'}
);
}
const topicUrl = (baseUrl, topic) => `${baseUrl}/${topic}`;
const shortUrl = (url) => url.replaceAll(/https?:\/\//g, "");
const shortTopicUrl = (baseUrl, topic) => shortUrl(topicUrl(baseUrl, topic))
function SubscriptionList(props) {
return (
{props.subscriptions.map(subscription => )}
);
}
function SubscriptionItem(props) {
return (
{shortTopicUrl(props.base_url, props.topic)}
);
}
function NotificationList(props) {
return (
{props.notifications.map(notification =>
)}
{props.timestamp}
{props.message}
);
}
function NotificationItem(props) {
return (
{props.time}
{props.message}
);
}
function SubscriptionAddForm(props) {
const [topic, setTopic] = useState("");
const handleSubmit = (ev) => {
ev.preventDefault();
props.onSubmit({
base_url: "https://ntfy.sh",
topic: topic,
});
}
return (
);
}
export default function App() {
const [state, setState] = useState({
subscriptions: [],
});
/*const subscriptions = [
{base_url: "https://ntfy.sh", topic: "mytopic"},
{base_url: "https://ntfy.sh", topic: "phils_alerts"},
];*/
const notifications = [
{id: "qGrfmhp3vK", times: 1645193395, message: "Message 1"},
{id: "m4YYjfxwyT", times: 1645193428, message: "Message 2"}
];
const addSubscription = (newSubscription) => {
setState(prevState => ({
subscriptions: [...prevState.subscriptions, newSubscription],
}));
}
return (
ntfy
);
}