Skip to content

Commit

Permalink
Renamed some directories to take advantage of nexts routing for more …
Browse files Browse the repository at this point in the history
…usable url paths
  • Loading branch information
Sebbben committed Sep 26, 2024
1 parent 028e072 commit 0d154f5
Show file tree
Hide file tree
Showing 50 changed files with 32 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
DATABASE_URL = 'mysql://${{ secrets.DATABASE_USER }}:${{ secrets.DATABASE_PASSWORD }}@localhost:3306/${{ secrets.DATABASE_NAME }}'
NEXTAUTH_URL = '${{ vars.NEXTAUTH_URL }}'
NEXTAUTH_CALLBACK = '${{ secrets.NEXTAUTH_URL }}/pages/main/home'
NEXTAUTH_CALLBACK = '${{ secrets.NEXTAUTH_URL }}/'
NEXTAUTH_SECRET = '${{ secrets.NEXTAUTH_SECRET }}'
NEXTAUTH_GITHUB_CLIENT_ID = '${{ vars.NEXTAUTH_GITHUB_CLIENT_ID }}'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
DATABASE_URL = 'mysql://${{ secrets.DATABASE_USER }}:${{ secrets.DATABASE_PASSWORD }}@localhost:3306/${{ secrets.DATABASE_NAME }}'
NEXTAUTH_URL = '${{ vars.NEXTAUTH_URL }}'
NEXTAUTH_CALLBACK = '${{ secrets.NEXTAUTH_URL }}/pages/main/home'
NEXTAUTH_CALLBACK = '${{ secrets.NEXTAUTH_URL }}/'
NEXTAUTH_SECRET = '${{ secrets.NEXTAUTH_SECRET }}'
NEXTAUTH_GITHUB_CLIENT_ID = '${{ vars.NEXTAUTH_GITHUB_CLIENT_ID }}'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DATABASE_SCHEMA = 'ISV2_development'
DATABASE_URL = "mysql://${DATABASE_USER}:${DATABASE_PASS}@localhost:3307/${DATABASE_SCHEMA}"
NEXTAUTH_URL = 'http://localhost:3005'
NEXTAUTH_CALLBACK = '/pages/main/home'
NEXTAUTH_CALLBACK = '/'
NEXTAUTH_SECRET = 'QuTxFdD3yon9X+83rRaio/vSgkfhvnwUglcIrnUwTLA='
NODEMAILER_NOREPLY_USER = 'noreply@cyb.no'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import { sanityClient } from "@/sanity/client";

const BUTTON_CONTENT_1 = [
// { title: "Economy", path: "volunteering/economy" },
// { title: "Café shifts", path: "/pages/main/volunteering/cafe" },
{ title: "Vouchers", path: "/pages/main/volunteering/logs" },
{ title: "Membership", path: "/pages/main/volunteering/membership" },
// { title: "Café shifts", path: "/volunteering/cafe" },
{ title: "Vouchers", path: "/volunteering/logs" },
{ title: "Membership", path: "/volunteering/membership" },
{ title: "Website content", path: "/studio" },
];

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/pages/auth/layout.js → app/(pages)/auth/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function AuthLayout({ children }) {
<body>
<ThemeProvider theme={cybTheme}>
<Box sx={{ p:2, px:3 }}>
<Link href={`/pages/main/home`}>
<Link href={`/`}>
<Avatar
sx={{
height: 45,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function registerPage() {

<Grid item container direction="row" justifyContent="flex-end">
<Link
href="/pages/auth/signIn"
href="/auth/signIn"
passHref
style={{ textDecoration: "none", cursor: "pointer" }}
>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function SignInPage() {
const router = useRouter()

if (session.status == "authenticated") {
router.push("/pages/main/home");
router.push("/");
return;
}

Expand Down Expand Up @@ -88,7 +88,7 @@ export default function SignInPage() {
justifyContent="flex-end"
>
<Link
href="/pages/auth/register"
href="/auth/register"
passHref
style={{ textDecoration: "none", cursor: "pointer" }}
>
Expand Down
2 changes: 1 addition & 1 deletion app/api/activate/[token]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ export async function GET(request, {params}) {
}
})

redirect("/pages/auth/signIn")
redirect("/auth/signIn")
}
2 changes: 1 addition & 1 deletion app/api/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const handler = NextAuth({
}
},
pages: {
signIn: "/pages/auth/signIn"
signIn: "/auth/signIn"
},
adapter: PrismaAdapter(prisma),
});
Expand Down
2 changes: 1 addition & 1 deletion app/api/sendVerification/route.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { mailOptions, transporter } from "@/app/pages/auth/email";
import { mailOptions, transporter } from "@/app/(pages)/auth/email";
import { NextResponse } from "next/server";

const NEXTAUTH_URL = process.env.NEXTAUTH_URL || "";
Expand Down
4 changes: 2 additions & 2 deletions app/components/Login/LoginButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function LoginButton(props) {
const handleClick = (event) => {
console.log("CLICK")
if (session.status == "authenticated") {
router.push("/pages/main/profile");
router.push("/profile");
} else {
signIn();
}
Expand Down Expand Up @@ -78,7 +78,7 @@ export default function LoginButton(props) {
key={`link_item_text_login`}
sx={{
color:
currentPath == `/pages/main/profile`
currentPath == `/profile`
? cybTheme.palette.primary.main
: cybTheme.palette.text.primary,
}}
Expand Down
10 changes: 5 additions & 5 deletions app/components/layout/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class NavBar extends Component {
sx={{ display: { xs: "none", md: "flex" } }}
>
<Grid item>
<Link href={`/pages/main/home`}>
<Link href={`/`}>
<Avatar
sx={{
height: 45,
Expand Down Expand Up @@ -101,7 +101,7 @@ function NavElementLargeScreen(item, index, currentPath) {
return (
<Link
key={`link_nav${index}`}
href={`/pages/main/${item.path}`}
href={`/${item.path}`}
style={{ textDecoration: "none" }}
>
<ListItem key={`link_nav${index}_item`} disablePadding>
Expand All @@ -110,7 +110,7 @@ function NavElementLargeScreen(item, index, currentPath) {
key={`link_nav${index}_itemtext`}
sx={{
color:
currentPath == `/pages/main/${item.path}`
currentPath == `/${item.path}`
? cybTheme.palette.primary.main
: cybTheme.palette.text.primary,
}}
Expand All @@ -135,7 +135,7 @@ function NavElementSmallScreen(item, index, iconProps, currentPath) {
return (
<Link
key={`link_snav${index}`}
href={`/pages/main/${item.path}`}
href={`/${item.path}`}
style={{ textDecoration: "none" }}
sx={{ width: "100%" }}
>
Expand All @@ -157,7 +157,7 @@ function NavElementSmallScreen(item, index, iconProps, currentPath) {
key={`link_snav${index}_itemtext`}
sx={{
color:
currentPath == `/pages/main/${item.path}`
currentPath == `/${item.path}`
? cybTheme.palette.primary.main
: cybTheme.palette.text.primary,
}}
Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/Breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function WebsiteBreadcrumbs(path, navItems) {
const path = `/${pathBits.slice(0, index + 1).join("/")}`;

return (
<Link key={"link_" + path} href={"/pages/main/" + path}>
<Link key={"link_" + path} href={"/" + path}>
<Typography
// color="text.primary"
variant="body2"
Expand Down
2 changes: 1 addition & 1 deletion app/components/layout/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const USEFUL_LINKS = [
},
{
name: "Rent Escape",
link: "/pages/main/aboutEscape/rentingEscape",
link: "/aboutEscape/rentingEscape",
},
{
name: "Submit issue",
Expand Down
2 changes: 1 addition & 1 deletion app/middleware/authWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useRouter } from "next/navigation";
import { useEffect } from "react";
import { PageBuilderSkeleton } from "../components/sanity/PageBuilder";

export default function authWrapper(WrappedComponent, requiredRole="", redirect="/pages/main/unauthorized") {
export default function authWrapper(WrappedComponent, requiredRole="", redirect="/unauthorized") {
return function AuthenticatedComponent(props) {

const router = useRouter();
Expand Down
10 changes: 5 additions & 5 deletions app/sitemap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@ import type { MetadataRoute } from "next";
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: "https://cyb.no/pages/main/home",
url: "https://cyb.no/",
lastModified: new Date(Date.parse("28 Aug 2024 00:00:00 GMT")),
changeFrequency: "yearly",
priority: 1,
},
{
url: "https://cyb.no/pages/main/aboutCYB",
url: "https://cyb.no/aboutCYB",
lastModified: new Date(Date.parse("28 Aug 2024 00:00:00 GMT")),
changeFrequency: "yearly",
priority: 1,
},
{
url: "https://cyb.no/pages/main/volunteering",
url: "https://cyb.no/volunteering",
lastModified: new Date(Date.parse("08 Sep 2024 00:00:00 GMT")),
changeFrequency: "yearly",
priority: 1,
},
{
url: "https://cyb.no/pages/main/aboutEscape/rentingEscape",
url: "https://cyb.no/aboutEscape/rentingEscape",
lastModified: new Date(Date.parse("08 Sep 2024 00:00:00 GMT")),
changeFrequency: "yearly",
priority: 1,
},
{
url: "https://cyb.no/pages/main/unauthorized",
url: "https://cyb.no/unauthorized",
lastModified: new Date(Date.parse("08 Sep 2024 00:00:00 GMT")),
changeFrequency: "yearly",
priority: 0.5,
Expand Down
14 changes: 4 additions & 10 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@ const nextConfig = {
async redirects() {
return [
{
source: "/",
destination: "/pages/main/home",
source: "/home",
destination: "/",
permanent: true,
basePath: false,
},
{
source: "/pages",
destination: "/pages/main/home",
permanent: true,
basePath: false,
},
{
source: "/pages/main",
destination: "/pages/main/home",
source: "/pages/main/home",
destination: "/",
permanent: true,
basePath: false,
},
Expand Down

0 comments on commit 0d154f5

Please sign in to comment.