Skip to content

Commit

Permalink
Fix linking issue on production
Browse files Browse the repository at this point in the history
  • Loading branch information
narwhal87 committed Oct 1, 2024
1 parent 89a5afb commit fa16209
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "my-app",
"version": "0.1.0",
"private": true,
"homepage": ".",
"homepage": "/~alpt22/editor",
"dependencies": {
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"sizes": "512x512"
}
],
"start_url": ".",
"start_url": "/~alpt22/editor",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
Expand Down
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import './App.css';

export default function App() {
return (
<Router>
<Router basename="/~alpt22/editor">

<div className="App">
<Header />
Expand Down
3 changes: 2 additions & 1 deletion src/all-documents.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getAll } from "./models/fetch";

//Components
import DocContent from "./doc-content";
import { Link } from "react-router-dom";

export default function AllDocuments() {
const [docs, setDocs] = useState([]);
Expand All @@ -26,7 +27,7 @@ export default function AllDocuments() {

const docItems = docs.map(doc =>
<li key={doc._id}>
<a href={'/id/' + doc._id}>{doc.title}</a>
<Link to={'/id/' + doc._id}>{doc.title}</Link>
<DocContent doccontent={doc.content} />
</li>
);
Expand Down
16 changes: 15 additions & 1 deletion src/forms/new-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function NewForm() {
} = useForm();

const onSubmit = async (data) => {

data.content = value;
console.log("Data: ", data);
const response = await addOne(data);
Expand All @@ -30,7 +31,20 @@ export function NewForm() {
<form onSubmit={handleSubmit(onSubmit)}>
{/* register your input into the hook by invoking the "register" function */}
<label htmlFor="title">Title</label>
<input id="title" type="text" name="title" {...register("title")} />
<input
id="title"
aria-invalid={errors.name ? "true" : "false"}
type="text"
name="title"
required="true"
{...register("title")}
onInvalid={e => {
e.currentTarget.setCustomValidity("A document title is required");
}}
onChange={e => {
e.currentTarget.setCustomValidity("");
}}
/>

{/* include validation with required or other standard HTML validation rules */}
<ReactQuill ReactQuill theme="snow" id='content' value={value} onChange={setValue} />
Expand Down
7 changes: 4 additions & 3 deletions src/header.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Link } from "react-router-dom";
import "./header.css";

function Header() {
return (
<header>
{
<div className="top">
<a href="/"><img src='/images/logo192.png' /></a>
<Link to="/"><img src='logo192.png' /></Link>
<div className="nav">
<a href="/"><h1>Home</h1></a>
<a href="/new"><h1>New</h1></a>
<Link to="/"><h1>Home</h1></Link>
<Link to="/new"><h1>New</h1></Link>
</div>
</div>
}
Expand Down

0 comments on commit fa16209

Please sign in to comment.