diff --git a/app/Controllers/Http/Api/AvatarController.ts b/app/Controllers/Http/Api/AvatarController.ts new file mode 100644 index 0000000..9678184 --- /dev/null +++ b/app/Controllers/Http/Api/AvatarController.ts @@ -0,0 +1,65 @@ +import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'; +import { StatusCodes } from 'http-status-codes'; +// import * as fs from 'fs'; +// import * as path from 'path'; + +const prefixes = ['von', 'van']; + +// node ace make:controller Author +export default class AvatarController { + public async generateAvatar({ request, response }: HttpContextContract) { + try { + const { name, background, textColor, size } = request.only(['name', 'background', 'textColor', 'size']); + + // Generate initials + // const initials = name + // .split(' ') + // .map((part) => part.charAt(0).toUpperCase()) + // .join(''); + const initials = this.getInitials(name); + + // Define SVG content with dynamic values for initials, background color, text color, and size + const svgContent = ` + + + ${initials} + + `; + + // Set response headers for SVG content + response.header('Content-type', 'image/svg+xml'); + response.header('Cache-Control', 'no-cache'); + response.header('Pragma', 'no-cache'); + response.header('Expires', '0'); + + return response.send(svgContent); + } catch (error) { + return response.status(StatusCodes.OK).json({ error: error.message }); + } + } + + private getInitials(name) { + const parts = name.split(' '); + let initials = ''; + + if (parts.length >= 2) { + const firstName = parts[0]; + const lastName = parts[parts.length - 1]; + + const firstInitial = firstName.charAt(0).toUpperCase(); + const lastInitial = lastName.charAt(0).toUpperCase(); + + if (prefixes.includes(lastName.toLowerCase()) && lastName === lastName.toUpperCase()) { + initials = firstInitial + lastName.charAt(1).toUpperCase(); + } else { + initials = firstInitial + lastInitial; + } + } else if (parts.length === 1) { + initials = parts[0].substring(0, 2).toUpperCase(); + } + + return initials; + } +} diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..d3d3eb5 Binary files /dev/null and b/public/favicon.png differ diff --git a/resources/js/Components/FirstrunWizard/components/Card.vue b/resources/js/Components/FirstrunWizard/components/Card.vue new file mode 100644 index 0000000..c3ecfbf --- /dev/null +++ b/resources/js/Components/FirstrunWizard/components/Card.vue @@ -0,0 +1,96 @@ + + + + + + diff --git a/resources/js/Components/FirstrunWizard/components/Page1.vue b/resources/js/Components/FirstrunWizard/components/Page1.vue new file mode 100644 index 0000000..df9667b --- /dev/null +++ b/resources/js/Components/FirstrunWizard/components/Page1.vue @@ -0,0 +1,56 @@ + + + + + \ No newline at end of file diff --git a/resources/js/Components/FirstrunWizard/components/pageStyles.css b/resources/js/Components/FirstrunWizard/components/pageStyles.css new file mode 100644 index 0000000..2d1bc56 --- /dev/null +++ b/resources/js/Components/FirstrunWizard/components/pageStyles.css @@ -0,0 +1,31 @@ +.page { + &__wrapper { + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: min(520px, 50vh); + } + + &__scroller { + overflow-y: scroll; + margin-top: calc(var(--default-grid-baseline) * 8); + } + + &__heading { + text-align: center; + } + + &__subtitle { + max-width: 450px; + margin: auto; + text-align: center; + } + + &__content { + display: flex; + flex-wrap: wrap; + gap: calc(var(--default-grid-baseline) * 6); + justify-content: center; + margin: calc(var(--default-grid-baseline) * 10) 0; + } +} diff --git a/resources/js/Components/Icons/AccountGroup.vue b/resources/js/Components/Icons/AccountGroup.vue new file mode 100644 index 0000000..e11cc4f --- /dev/null +++ b/resources/js/Components/Icons/AccountGroup.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/resources/js/Components/Icons/BriefcaseCheck.vue b/resources/js/Components/Icons/BriefcaseCheck.vue new file mode 100644 index 0000000..cfbee6a --- /dev/null +++ b/resources/js/Components/Icons/BriefcaseCheck.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/resources/js/Components/Icons/Lock.vue b/resources/js/Components/Icons/Lock.vue new file mode 100644 index 0000000..b1efa96 --- /dev/null +++ b/resources/js/Components/Icons/Lock.vue @@ -0,0 +1,31 @@ + + + \ No newline at end of file diff --git a/resources/js/Components/Icons/SwapHorizontal.vue b/resources/js/Components/Icons/SwapHorizontal.vue new file mode 100644 index 0000000..77054f1 --- /dev/null +++ b/resources/js/Components/Icons/SwapHorizontal.vue @@ -0,0 +1,30 @@ + + + \ No newline at end of file diff --git a/resources/js/Components/NavBar.vue b/resources/js/Components/NavBar.vue index f8d4a36..dce8a4d 100644 --- a/resources/js/Components/NavBar.vue +++ b/resources/js/Components/NavBar.vue @@ -19,12 +19,15 @@ import { mdiCloudDownloadOutline, mdiCloud, mdiCrop, - mdiAccount, - mdiCogOutline, - mdiEmail, + mdiAccountCog, + mdiFormatListGroup , + mdiFormatListNumbered, + // mdiEmail, mdiLogout, mdiGithub, mdiThemeLightDark, + mdiViewDashboard, + mdiMapSearch } from '@mdi/js'; import NavBarItem from '@/Components/NavBarItem.vue'; import NavBarItemLabel from '@/Components/NavBarItemLabel.vue'; @@ -32,20 +35,25 @@ import NavBarMenu from '@/Components/NavBarMenu.vue'; import BaseDivider from '@/Components/BaseDivider.vue'; import UserAvatarCurrentUser from '@/Components/UserAvatarCurrentUser.vue'; import BaseIcon from '@/Components/BaseIcon.vue'; -import NavBarSearch from '@/Components/NavBarSearch.vue'; +// import NavBarSearch from '@/Components/NavBarSearch.vue'; import { stardust } from '@eidellev/adonis-stardust/client'; import type { User } from '@/Dataset'; +// import FirstrunWizard from '@/Components/FirstrunWizard/FirstrunWizard.vue' +import Lock from 'vue-material-design-icons/Lock.vue' +// import BriefcaseCheck from 'vue-material-design-icons/BriefcaseCheck.vue' +// import SwapHorizontal from 'vue-material-design-icons/SwapHorizontal.vue' +// import AccountGroup from 'vue-material-design-icons/AccountGroup.vue' // const mainStore = MainService(); // const userName = computed(() =>mainStore.userName); const styleService = StyleService(); -// const props = defineProps({ -// user: { -// type: Object, -// default: () => ({}), -// } -// }); +const props = defineProps({ + showBurger: { + type: Boolean, + default: true // Set default value to true + } +}); // const userName = computed(() => usePage().props.user.login) const user: ComputedRef = computed(() => { @@ -80,32 +88,41 @@ const logout = async () => { // router.post(route('logout')); await router.post(stardust.route('logout')); }; +