diff --git a/web/src/App.js b/web/src/App.js
index 7d52df94..d8c1c21f 100644
--- a/web/src/App.js
+++ b/web/src/App.js
@@ -3,38 +3,24 @@ 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))
+import Subscription from './Subscription';
+import WsConnection from './WsConnection';
function SubscriptionList(props) {
return (
- {props.subscriptions.map(subscription => )}
+ {props.subscriptions.map(subscription =>
+ )}
);
}
function SubscriptionItem(props) {
+ const subscription = props.subscription;
return (
-
{shortTopicUrl(props.base_url, props.topic)}
+
{subscription.shortUrl()}
);
}
@@ -49,7 +35,7 @@ function NotificationList(props) {
);
}
-function NotificationItem(props) {
+const NotificationItem = (props) => {
return (
{props.time}
@@ -58,14 +44,14 @@ function NotificationItem(props) {
);
}
-function SubscriptionAddForm(props) {
+const defaultBaseUrl = "https://ntfy.sh"
+
+const SubscriptionAddForm = (props) => {
const [topic, setTopic] = useState("");
const handleSubmit = (ev) => {
ev.preventDefault();
- props.onSubmit({
- base_url: "https://ntfy.sh",
- topic: topic,
- });
+ props.onSubmit(new Subscription(defaultBaseUrl, topic));
+ setTopic('');
}
return (