Skip to content

Commit

Permalink
content
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-jaap committed Jun 6, 2024
1 parent c08bc3e commit 17fbf84
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 251 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public function getPageContent(Request $request, string $page)
});

return response()->json([
'data' => $data
'data' => $data,
'debug' => ['page' => $page]
]);

}
}
124 changes: 44 additions & 80 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,53 @@
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
import "./bootstrap";
import { createApp } from "vue";
import App from "./components/App.vue";
import router from "./router.js";
import i18n from "./i18n.js";

import './bootstrap';
import {createApp} from 'vue';
import App from './components/App.vue';
import router from './router.js';
import i18n from './i18n.js';

import 'vuetify/styles'
import {createVuetify} from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'
import '@mdi/font/css/materialdesignicons.css'
import {aliases, mdi} from 'vuetify/iconsets/mdi'
import AutoLoadTable from './components/ui/AutoLoadTable.vue';
import IndexPage from "./components/layout/IndexPage.vue";
import SinglePage from "./components/layout/home/SingleHomePage.vue";
import {createPinia} from "pinia";
import "vuetify/styles";
import { createVuetify } from "vuetify";
import * as components from "vuetify/components";
import * as directives from "vuetify/directives";
import "@mdi/font/css/materialdesignicons.css";
import { aliases, mdi } from "vuetify/iconsets/mdi";
import { createPinia } from "pinia";

const myCustomLightTheme = {
dark: false,
colors: {
background: '#FFFFFF',
surface: '#FFFFFF',
primary: '#6A9CD1',
'primary-lighten': '#C3D7EC',
secondary: '#03DAC6',
error: '#B00020',
info: '#2196F3',
success: '#4CAF50',
warning: '#FB8C00',
},
}
dark: false,
colors: {
background: "#FFFFFF",
surface: "#FFFFFF",
primary: "#6A9CD1",
"primary-lighten": "#C3D7EC",
secondary: "#03DAC6",
error: "#B00020",
info: "#2196F3",
success: "#4CAF50",
warning: "#FB8C00",
},
};

const vuetify = createVuetify({
icons: {
defaultSet: 'mdi',
aliases,
sets: {
mdi,
},
},
theme: {
defaultTheme: 'myCustomLightTheme',
themes: {
myCustomLightTheme,
}
icons: {
defaultSet: "mdi",
aliases,
sets: {
mdi,
},
components: {
...components,
},
theme: {
defaultTheme: "myCustomLightTheme",
themes: {
myCustomLightTheme,
},
directives,
})
/**
* Next, we will create a fresh Vue application instance. You may then begin
* registering components with the application instance so they are ready
* to use in your application's views. An example is included for you.
*/
const pinia = createPinia()
const app = createApp(App);

/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
},
components: {
...components,
},
directives,
});

// Object.entries(import.meta.glob('./**/*.vue', { eager: true })).forEach(([path, definition]) => {
// app.component(path.split('/').pop().replace(/\.\w+$/, ''), definition.default);
// });
const pinia = createPinia();
const app = createApp(App);

/**
* Finally, we will attach the application instance to a HTML element with
* an "id" attribute of "app". This element is included with the "auth"
* scaffolding. Otherwise, you will need to add an element yourself.
*/
app.component('index-page', IndexPage)
.component('single-page', SinglePage)
.use(vuetify)
.use(router)
.use(i18n)
.use(pinia)
.mount('#app');
app.use(vuetify).use(router).use(i18n).use(pinia).mount("#app");
7 changes: 6 additions & 1 deletion resources/js/components/layout/sections/DebugSection.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<template>
<v-container v-if="auth">
<v-container v-if="user && user.type === 'admin'">
<pre><slot></slot></pre>
</v-container>
</template>
<script>
import PageSection from "@/components/layout/sections/PageSection.vue";
import { useAuthStore } from "@/stores/auth/index.js";
import { mapState } from "pinia";
export default {
name: "DebugSection",
components: { PageSection },
computed: {
...mapState(useAuthStore, ["user"]),
},
};
</script>
<style scoped>
Expand Down
5 changes: 4 additions & 1 deletion resources/js/components/layout/sections/InfoSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
<h2 class="text-h3 mb-8">{{ title }}</h2>
<p class="text-h6">{{ description }}</p>
<template v-if="to !== undefined">
<v-btn variant="outlined" class="mt-8" :to="{ name: to.name }"
<v-btn
variant="outlined"
class="mt-8"
:to="{ name: to.name, hash: to.hash ? '#' + to.hash : undefined }"
>{{ $t(buttonText) }} &rarr;</v-btn
>
</template>
Expand Down
12 changes: 9 additions & 3 deletions resources/js/components/layout/sections/TabbedSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ tab.title }}
</v-tab>
</v-tabs>
<text-section :section="content" />
<text-section v-if="content" :section="content" />
</page-section>
</template>
<script>
Expand All @@ -18,16 +18,18 @@ import PageSection from "@/components/layout/sections/PageSection.vue";
import { mapActions, mapState } from "pinia";
import { useContentStore } from "@/stores/content/index.js";
import TextSection from "@/components/layout/sections/TextSection.vue";
import DebugSection from "@/components/layout/sections/DebugSection.vue";
export default {
name: "TabbedSection",
props: {
section: Object,
parent: String,
},
components: { TextSection, PageSection },
components: { DebugSection, TextSection, PageSection },
data() {
return {
selectedTab: undefined,
selectedTab:
this.$route.hash.replace("#", "") || this.section.tabs[0].page,
};
},
computed: {
Expand All @@ -45,6 +47,10 @@ export default {
marked,
...mapActions(useContentStore, ["loadPage", "clearPage"]),
},
mounted() {
console.log(this.selectedTab, this.parent);
this.loadPage(this.selectedTab, this.parent);
},
watch: {
selectedTab(val) {
console.log("tab selected " + val);
Expand Down
72 changes: 10 additions & 62 deletions resources/js/components/nav/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,70 +18,18 @@
<template v-if="!inPortal">
<v-btn :to="{ name: 'home' }" exact>{{ $t("nav.home") }}</v-btn>
<v-btn :to="{ name: 'about' }" exact>{{ $t("nav.about") }}</v-btn>
<v-btn :to="{ name: 'how-it-works' }" exact>{{
$t("nav.how-it-works")
}}</v-btn>
<v-btn v-if="user" :to="{ name: 'dashboard' }">{{
$t("nav.portal")
}}</v-btn>
<v-btn v-if="!user" :to="{ name: 'login' }">{{
$t("nav.login")
}}</v-btn>
<v-btn v-if="user" :to="{ name: 'dashboard' }"
>{{ $t("nav.portal") }}
</v-btn>
</template>
</v-toolbar-items>

<!-- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent"-->
<!-- aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">-->
<!-- <span class="navbar-toggler-icon"></span>-->
<!-- </button>-->

<!-- <div class="collapse navbar-collapse" id="navbarSupportedContent">-->
<!-- &lt;!&ndash; Left Side Of Navbar &ndash;&gt;-->
<!-- <ul class="navbar-nav me-auto">-->

<!-- </ul>-->

<!-- &lt;!&ndash; Right Side Of Navbar &ndash;&gt;-->
<!-- <ul class="navbar-nav ms-auto">-->
<!-- &lt;!&ndash; Authentication Links &ndash;&gt;-->
<!-- <template v-if="user">-->
<!-- <li class="nav-item">-->
<!-- <router-link class="nav-link" :to="{name: 'home'}">Home</router-link>-->
<!-- </li>-->

<!-- <li class="nav-item">-->
<!-- <router-link class="nav-link" :to="{name: 'portal'}">Portal</router-link>-->
<!-- </li>-->

<!-- <li class="nav-item dropdown">-->
<!-- <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"-->
<!-- aria-haspopup="true" aria-expanded="false">-->
<!-- {{ user.name }}-->
<!-- </a>-->
<!-- <ul class="dropdown-menu dropdown-menu-end">-->
<!-- <li>-->

<!-- <button class="dropdown-item" @click="logout">-->
<!-- Logout-->
<!-- </button>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </li>-->

<!-- </template>-->

<!-- <template v-else>-->

<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="/login">Login</a>-->
<!-- </li>-->
<!-- <li class="nav-item">-->
<!-- <a class="nav-link" href="/register">Register</a>-->
<!-- </li>-->

<!-- </template>-->
<!-- </ul>-->
<!-- </div>-->
<v-btn
variant="elevated"
color="warning"
v-if="!user"
:to="{ name: 'login' }"
>{{ $t("nav.login") }}
</v-btn>
</v-app-bar>
</template>
<script>
Expand Down
9 changes: 2 additions & 7 deletions resources/js/routes/PublicRoutes.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
const ApiContentPage = () => import("@/components/layout/ApiContentPage.vue");
const DefaultPage = () => import("@/views/Public/Pages/Default.vue");

export default [
{
path: "",
name: "home",
component: () => import("@/views/Public/Home/Home.vue"),
component: DefaultPage,
},
{
path: "about",
name: "about",
component: DefaultPage,
},
{
path: "how-it-works",
name: "how-it-works",
component: DefaultPage,
},
{
path: "login",
name: "login",
Expand Down
2 changes: 2 additions & 0 deletions resources/js/stores/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const useContentStore = defineStore("content", {
return;
}

console.log(page, pageSlug, parent);

this.loading.push(page);

axios
Expand Down
19 changes: 12 additions & 7 deletions resources/js/views/Public.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
<template>
<nav-bar/>
<nav-bar />
<v-main class="d-flex flex-column flex-grow-1">
<div class="flex-grow-1">
<router-view v-slot="{ Component }">
<transition name="fade" mode="out-in">
<component :is="Component"/>
<component :is="Component" :key="route.name" />
</transition>
</router-view>
</div>
</v-main>
<public-footer/>
<default-snackbar/>
<public-footer />
<default-snackbar />
</template>
<script>
import NavBar from "../components/nav/NavBar.vue";
import PublicFooter from "../components/nav/PublicFooter.vue";
import DefaultSnackbar from "../components/ui/DefaultSnackbar.vue";
export default {
name: 'Portal',
components: {DefaultSnackbar, PublicFooter, NavBar},
}
name: "Portal",
components: { DefaultSnackbar, PublicFooter, NavBar },
computed: {
route() {
return this.$route;
},
},
};
</script>
26 changes: 0 additions & 26 deletions resources/js/views/Public/About/About.vue

This file was deleted.

Loading

0 comments on commit 17fbf84

Please sign in to comment.