Skip to content

Commit

Permalink
Fatty link spa (ZcashFoundation#62)
Browse files Browse the repository at this point in the history
Ham on the links
  • Loading branch information
skyl authored Jan 15, 2023
1 parent cd7a1eb commit 8fe5610
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 21 deletions.
3 changes: 3 additions & 0 deletions ts/react/free2z/src/EditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export default function EditPage() {
// setLoading(false)
// return new Promise()
// }
// setLoading(true)
return axios.post('/api/zpage/', page, {
headers: headers
}).then((res) => {
Expand Down Expand Up @@ -227,12 +228,14 @@ export default function EditPage() {
}

useEffect(() => {
// setLoading(true)
// console.log("USE EFFECTG PARAMS", id)
if (id === "new") {
// console.log("PARAMS NEW SETTING BLANK")
// wtf??
setPage(newPage)
setErrors(noErrors)
// setLoading(false)
return
}
// console.log("call refreshPage fun useEffect")
Expand Down
5 changes: 4 additions & 1 deletion ts/react/free2z/src/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import TuziIcon from "./components/TuziIcon"
// import TwitterOAuthButton from "./components/TwitterOAuthButton"
import TwitterLoginButton from "./components/TwitterLoginButton"

import { Link as RouterLink } from 'react-router-dom';


export default function Profile() {
const location = useLocation()
Expand Down Expand Up @@ -369,7 +371,8 @@ export default function Profile() {
</Typography>
<Link
target="_blank"
href="/fans-and-stars"
to="/fans-and-stars"
component={RouterLink}
>
<QuestionMark />
</Link>
Expand Down
13 changes: 9 additions & 4 deletions ts/react/free2z/src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Grid, Link, Box, Stack } from "@mui/material"
import { useNavigate } from "react-router-dom"
import { Link, Box, Stack } from "@mui/material"
import { Link as RouterLink } from 'react-router-dom';


export default function Footer() {

Expand All @@ -16,13 +17,17 @@ export default function Footer() {
<Link color="inherit" variant="caption" href="/docs/">
Help
</Link>
<Link color="inherit" variant="caption" href="/terms">
<Link
color="inherit" variant="caption" to="/terms"
component={RouterLink}
>
Terms of Service
</Link>
<Link
color="inherit"
variant="caption"
href="/privacy-policy"
to="/privacy-policy"
component={RouterLink}
>
Privacy Policy
</Link>
Expand Down
6 changes: 3 additions & 3 deletions ts/react/free2z/src/components/MakePageComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ import { getURI, current_f2z_address } from "../Constants"
import QRAddress from "./QRAddress"
import { QuestionMarkRounded } from "@mui/icons-material"
import MathMarkdown from "./MathMarkdown"
// import { Link, Navigate } from 'react-router-dom';

import { Link as RouterLink } from 'react-router-dom';
export interface MakePageCommentProps {
free2zaddr: string
}
Expand All @@ -50,7 +49,8 @@ export default function MakePageComment(props: MakePageCommentProps) {
<InputAdornment position="end">
<Link
target="_blank"
href="/flavored-markdown"
to="/flavored-markdown"
component={RouterLink}
>
<QuestionMarkRounded color="info" />
</Link>
Expand Down
14 changes: 11 additions & 3 deletions ts/react/free2z/src/components/PageListRow2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import CreatorDonate from "./CreatorDonate";
import { PageInterface } from "./PageRenderer";
import UpDownPage from "./UpDownPage";

import { Link as RouterLink } from 'react-router-dom';


export interface PageListRowProps extends PageInterface {
mine: boolean
}
Expand Down Expand Up @@ -58,7 +61,10 @@ export default function PageListRow(page: PageListRowProps) {
<CardHeader
disableTypography={true}
avatar={
<Link href={`/${page.creator.username}`}>
<Link
to={`/${page.creator.username}`}
component={RouterLink}
>
<Avatar
// Kinda small
// sx={{
Expand Down Expand Up @@ -89,7 +95,8 @@ export default function PageListRow(page: PageListRowProps) {
// WebkitLineClamp: "2",
// WebkitBoxOrient: "vertical",
// }}
href={page.mine ? `/edit/${page.vanity || page.free2zaddr}` : page.get_url}
component={RouterLink}
to={page.mine ? `/edit/${page.vanity || page.free2zaddr}` : page.get_url}
>
{page.title}
</Link>
Expand All @@ -107,8 +114,9 @@ export default function PageListRow(page: PageListRowProps) {
}}
>
by <Link
href={`/${page.creator.username}`}
to={`/${page.creator.username}`}
color="secondary"
component={RouterLink}
>
{page.creator.username}
</Link>
Expand Down
20 changes: 11 additions & 9 deletions ts/react/free2z/src/components/SimpleNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import { Divider, Grid, IconButton, Tooltip } from "@mui/material"

import DarkMode from "./DarkMode"

import { Link as RouterLink } from 'react-router-dom';


export default function SimpleNav() {
const location = useLocation()
const navigate = useNavigate()
Expand All @@ -26,8 +29,9 @@ export default function SimpleNav() {
<Grid item xs={2} md={1}>
<Tooltip title="Home" color="primary">
<IconButton
href="/"
to="/"
size="large"
component={RouterLink}
>
<Home />
</IconButton>
Expand All @@ -40,7 +44,8 @@ export default function SimpleNav() {
<IconButton
color="info"
size="large"
href="/profile"
to="/profile"
component={RouterLink}
>
<ManageAccounts />
</IconButton>
Expand All @@ -54,7 +59,8 @@ export default function SimpleNav() {
<IconButton
size="large"
color="secondary"
href="/find"
to="/find"
component={RouterLink}
>
<Search />
</IconButton>
Expand All @@ -66,12 +72,8 @@ export default function SimpleNav() {
<IconButton
size="large"
color="success"
href="/edit/new"
onClick={() => {
navigate("/edit/new")
// not sure why we have this :9
window.location.replace("/edit/new")
}}
to="/edit/new"
component={RouterLink}
>
<AddCircle />
</IconButton>
Expand Down
5 changes: 4 additions & 1 deletion ts/react/free2z/src/components/YouAreSubscribed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import TuziIcon from "./TuziIcon";
import Cookies from "js-cookie";
import { Box } from "@mui/system";
import { getRando } from "./EditFundPage";
import { Link as RouterLink } from 'react-router-dom';


export const STOKED = [
"stoked",
Expand Down Expand Up @@ -116,7 +118,8 @@ export default function YouAreSubscribed(props: PublicCreator) {
</Typography> */}
<Link
target="_blank"
href="/fans-and-stars"
to="/fans-and-stars"
component={RouterLink}
>
<QuestionMark />
</Link>
Expand Down

0 comments on commit 8fe5610

Please sign in to comment.