mirror of
https://github.com/kevin-DL/comedy-video-lib.git
synced 2026-01-12 03:05:13 +00:00
746 lines
30 KiB
Vue
746 lines
30 KiB
Vue
<template>
|
|
<!-- <div class="h-screen flex overflow-hidden bg-white">
|
|
<Nuxt />
|
|
</div> -->
|
|
<!--
|
|
Tailwind UI components require Tailwind CSS v1.8 and the @tailwindcss/ui plugin.
|
|
Read the documentation to get started: https://tailwindui.com/documentation
|
|
-->
|
|
<div class="h-screen flex overflow-hidden bg-white">
|
|
<!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. -->
|
|
<div class="lg:hidden" v-if="sidebarToggled" @click="toggleSidebar">
|
|
<div class="fixed inset-0 flex z-40">
|
|
<!--
|
|
Off-canvas menu overlay, show/hide based on off-canvas menu state.
|
|
|
|
Entering: "transition-opacity ease-linear duration-300"
|
|
From: "opacity-0"
|
|
To: "opacity-100"
|
|
Leaving: "transition-opacity ease-linear duration-300"
|
|
From: "opacity-100"
|
|
To: "opacity-0"
|
|
-->
|
|
<transition
|
|
enter-active-class="transition-opacity ease-linear duration-300"
|
|
enter-class="opacity-0"
|
|
enter-to-class="opacity-100"
|
|
leave-active-class="transition-opacity ease-linear duration-300"
|
|
leave-class="opacity-100"
|
|
leave-to-class="opacity-0"
|
|
>
|
|
<div class="fixed inset-0">
|
|
<div class="absolute inset-0 bg-gray-600 opacity-75"></div>
|
|
</div>
|
|
</transition>
|
|
<!--
|
|
Off-canvas menu, show/hide based on off-canvas menu state.
|
|
|
|
Entering: "transition ease-in-out duration-300 transform"
|
|
From: "-translate-x-full"
|
|
To: "translate-x-0"
|
|
Leaving: "transition ease-in-out duration-300 transform"
|
|
From: "translate-x-0"
|
|
To: "-translate-x-full"
|
|
-->
|
|
<transition
|
|
enter-active-class="transition ease-in-out duration-300 transform"
|
|
enter-class="-translate-x-full"
|
|
enter-to-class="translate-x-0"
|
|
leave-active-class="transition ease-in-out duration-300 transform"
|
|
leave-class="translate-x-0"
|
|
leave-to-class="-translate-x-full"
|
|
>
|
|
<div
|
|
class="relative flex-1 flex flex-col max-w-xs w-full pt-5 pb-4 bg-white"
|
|
>
|
|
<div class="absolute top-0 right-0 -mr-14 p-1">
|
|
<button
|
|
class="flex items-center justify-center h-12 w-12 rounded-full focus:outline-none focus:bg-gray-600"
|
|
aria-label="Close sidebar"
|
|
>
|
|
<svg
|
|
class="h-6 w-6 text-white"
|
|
stroke="currentColor"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M6 18L18 6M6 6l12 12"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div class="flex-shrink-0 flex items-center px-4">
|
|
<img
|
|
class="h-8 w-auto"
|
|
src="https://tailwindui.com/img/logos/v1/workflow-logo-purple-on-white.svg"
|
|
alt="Workflow"
|
|
/>
|
|
</div>
|
|
<div class="mt-5 flex-1 h-0 overflow-y-auto">
|
|
<nav class="px-2">
|
|
<div class="space-y-1">
|
|
<nuxt-link
|
|
to="/"
|
|
class="group flex items-center px-2 py-2 text-base leading-5 font-medium rounded-md text-gray-900 bg-gray-100 hover:text-gray-900 hover:bg-gray-100 focus:bg-gray-200 focus:outline-none transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: home -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-500 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
/>
|
|
</svg>
|
|
Home
|
|
</nuxt-link>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-2 py-2 text-base leading-5 font-medium rounded-md text-gray-600 hover:text-gray-900 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: view-list -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-400 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
/>
|
|
</svg>
|
|
My tasks
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-2 py-2 text-base leading-5 font-medium rounded-md text-gray-600 hover:text-gray-900 hover:bg-gray-50 focus:bg-gray-50 focus:outline-none transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: clock -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-400 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
/>
|
|
</svg>
|
|
Recent
|
|
</a>
|
|
</div>
|
|
<div class="mt-8">
|
|
<h3
|
|
class="px-3 text-xs leading-4 font-semibold text-gray-500 uppercase tracking-wider"
|
|
id="teams-headline"
|
|
>
|
|
Teams
|
|
</h3>
|
|
<div
|
|
class="mt-1 space-y-1"
|
|
role="group"
|
|
aria-labelledby="teams-headline"
|
|
>
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-base leading-5 font-medium text-gray-600 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-indigo-500 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Engineering </span>
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-base leading-5 font-medium text-gray-600 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-teal-400 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Human Resources </span>
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-base leading-5 font-medium text-gray-600 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-orange-500 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Customer Success </span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
<div class="flex-shrink-0 w-14">
|
|
<!-- Dummy element to force sidebar to shrink to fit close icon -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Static sidebar for desktop -->
|
|
<div class="hidden lg:flex lg:flex-shrink-0">
|
|
<div
|
|
class="flex flex-col w-64 border-r border-gray-200 pt-5 pb-4 bg-gray-100"
|
|
>
|
|
<div class="flex items-center flex-shrink-0 px-6">
|
|
<img
|
|
class="h-8 w-auto"
|
|
src="https://tailwindui.com/img/logos/v1/workflow-logo-purple-on-white.svg"
|
|
alt="Workflow"
|
|
/>
|
|
</div>
|
|
<!-- Sidebar component, swap this element with another sidebar if you like -->
|
|
<div class="h-0 flex-1 flex flex-col overflow-y-auto">
|
|
<!-- User account dropdown -->
|
|
<div
|
|
v-if="currentUser.isLoggedIn"
|
|
class="px-3 mt-6 relative inline-block text-left"
|
|
>
|
|
<!-- Dropdown menu toggle, controlling the show/hide state of dropdown menu. -->
|
|
<div @click="toggleUserMenu">
|
|
<button
|
|
type="button"
|
|
class="group w-full rounded-md px-3.5 py-2 text-sm leading-5 font-medium text-gray-700 hover:bg-gray-50 hover:text-gray-500 focus:outline-none focus:bg-gray-200 focus:border-blue-300 active:bg-gray-50 active:text-gray-800 transition ease-in-out duration-150"
|
|
id="options-menu"
|
|
aria-haspopup="true"
|
|
aria-expanded="true"
|
|
>
|
|
<div class="flex w-full justify-between items-center">
|
|
<div
|
|
class="flex min-w-0 items-center justify-between space-x-3"
|
|
>
|
|
<img
|
|
class="w-10 h-10 bg-gray-300 rounded-full flex-shrink-0"
|
|
:src="currentUser.profile.picture || ''"
|
|
alt=""
|
|
/>
|
|
<div class="flex-1 min-w-0">
|
|
<h2
|
|
class="text-gray-900 text-sm leading-5 font-medium truncate"
|
|
>
|
|
{{ currentUser.profile.displayName || 'N/A' }}
|
|
</h2>
|
|
<!-- <p class="text-gray-500 text-sm leading-5 truncate">-->
|
|
<!-- @jessyschwarz-->
|
|
<!-- </p>-->
|
|
</div>
|
|
</div>
|
|
<!-- Heroicon name: selector -->
|
|
<svg
|
|
class="flex-shrink-0 h-5 w-5 text-gray-400 group-hover:text-gray-500"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor"
|
|
>
|
|
<path
|
|
fill-rule="evenodd"
|
|
d="M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z"
|
|
clip-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
</button>
|
|
</div>
|
|
<!--
|
|
Dropdown panel, show/hide based on dropdown state.
|
|
|
|
Entering: "transition ease-out duration-100"
|
|
From: "transform opacity-0 scale-95"
|
|
To: "transform opacity-100 scale-100"
|
|
Leaving: "transition ease-in duration-75"
|
|
From: "transform opacity-100 scale-100"
|
|
To: "transform opacity-0 scale-95"
|
|
-->
|
|
<transition
|
|
enter-active-class="transition ease-out duration-100"
|
|
enter-class="transform opacity-0 scale-95"
|
|
enter-to-class="transform opacity-100 scale-100"
|
|
leave-active-class="transition ease-in duration-75"
|
|
leave-class="transform opacity-100 scale-100"
|
|
leave-to-class="transform opacity-0 scale-95"
|
|
>
|
|
<div
|
|
v-if="userMenuToggled"
|
|
class="z-10 mx-3 origin-top absolute right-0 left-0 mt-1 rounded-md shadow-lg"
|
|
@click="toggleUserMenu"
|
|
>
|
|
<div
|
|
class="rounded-md bg-white shadow-xs"
|
|
role="menu"
|
|
aria-orientation="vertical"
|
|
aria-labelledby="options-menu"
|
|
>
|
|
<div class="py-1">
|
|
<nuxt-link
|
|
to="/profile"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>View profile</nuxt-link
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Settings</a
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Notifications</a
|
|
>
|
|
</div>
|
|
<div class="border-t border-gray-100"></div>
|
|
<div class="py-1">
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Get desktop app</a
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Support</a
|
|
>
|
|
</div>
|
|
<div class="border-t border-gray-100"></div>
|
|
<div class="py-1">
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
@click="logout"
|
|
>Logout</a
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
</div>
|
|
<button v-else>
|
|
<nuxt-link to="/login">Login</nuxt-link>
|
|
</button>
|
|
<!-- Sidebar Search -->
|
|
<div class="px-3 mt-5">
|
|
<label for="search" class="sr-only">Search</label>
|
|
<div class="mt-1 relative rounded-md shadow-sm">
|
|
<div
|
|
class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
|
|
>
|
|
<!-- Heroicon name: search -->
|
|
<svg
|
|
class="mr-3 h-4 w-4 text-gray-400"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor"
|
|
>
|
|
<path
|
|
fill-rule="evenodd"
|
|
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
|
|
clip-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<input
|
|
id="search"
|
|
class="form-input block w-full pl-9 sm:text-sm sm:leading-5"
|
|
placeholder="Search"
|
|
/>
|
|
</div>
|
|
</div>
|
|
<!-- Navigation -->
|
|
<nav class="px-3 mt-6">
|
|
<div class="space-y-1">
|
|
<nuxt-link
|
|
to="/"
|
|
class="group flex items-center px-2 py-2 text-sm leading-5 font-medium rounded-md text-gray-900 bg-gray-200 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: home -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-500 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
/>
|
|
</svg>
|
|
Home
|
|
</nuxt-link>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-2 py-2 text-sm leading-5 font-medium rounded-md text-gray-700 hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: view-list -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-400 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
/>
|
|
</svg>
|
|
My tasks
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-2 py-2 text-sm leading-5 font-medium rounded-md text-gray-700 hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<!-- Heroicon name: clock -->
|
|
<svg
|
|
class="mr-3 h-6 w-6 text-gray-400 group-hover:text-gray-500 group-focus:text-gray-600 transition ease-in-out duration-150"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
/>
|
|
</svg>
|
|
Recent
|
|
</a>
|
|
</div>
|
|
<div class="mt-8">
|
|
<!-- Secondary navigation -->
|
|
<h3
|
|
class="px-3 text-xs leading-4 font-semibold text-gray-500 uppercase tracking-wider"
|
|
id="teams-headline"
|
|
>
|
|
Teams
|
|
</h3>
|
|
<div
|
|
class="mt-1 space-y-1"
|
|
role="group"
|
|
aria-labelledby="teams-headline"
|
|
>
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-sm leading-5 font-medium text-gray-700 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-indigo-500 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Engineering </span>
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-sm leading-5 font-medium text-gray-700 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-teal-400 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Human Resources </span>
|
|
</a>
|
|
|
|
<a
|
|
href="#"
|
|
class="group flex items-center px-3 py-2 text-sm leading-5 font-medium text-gray-700 rounded-md hover:text-gray-900 hover:bg-gray-50 focus:outline-none focus:bg-gray-50 transition ease-in-out duration-150"
|
|
>
|
|
<span
|
|
class="w-2.5 h-2.5 mr-4 bg-orange-500 rounded-full"
|
|
></span>
|
|
<span class="truncate"> Customer Success </span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- Main column -->
|
|
<div class="flex flex-col w-0 flex-1 overflow-hidden">
|
|
<!-- Search header -->
|
|
<div
|
|
class="relative z-10 flex-shrink-0 flex h-16 bg-white border-b border-gray-200 lg:hidden"
|
|
>
|
|
<!-- Sidebar toggle, controls the 'sidebarOpen' sidebar state. -->
|
|
<button
|
|
class="px-4 border-r border-gray-200 text-gray-500 focus:outline-none focus:bg-gray-100 focus:text-gray-600 lg:hidden"
|
|
aria-label="Open sidebar"
|
|
@click="toggleSidebar"
|
|
>
|
|
<svg
|
|
class="h-6 w-6"
|
|
fill="none"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path d="M4 6h16M4 12h8m-8 6h16" />
|
|
</svg>
|
|
</button>
|
|
<div class="flex-1 flex justify-between px-4 sm:px-6 lg:px-8">
|
|
<div class="flex-1 flex">
|
|
<form class="w-full flex md:ml-0" action="#" method="GET">
|
|
<label for="search_field" class="sr-only">Search</label>
|
|
<div
|
|
class="relative w-full text-gray-400 focus-within:text-gray-600"
|
|
>
|
|
<div
|
|
class="absolute inset-y-0 left-0 flex items-center pointer-events-none"
|
|
>
|
|
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
|
|
<path
|
|
fill-rule="evenodd"
|
|
clip-rule="evenodd"
|
|
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<input
|
|
id="search_field"
|
|
class="block w-full h-full pl-8 pr-3 py-2 rounded-md text-gray-900 placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 sm:text-sm"
|
|
placeholder="Search"
|
|
type="search"
|
|
/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="flex items-center">
|
|
<!-- Profile dropdown -->
|
|
<div class="ml-3 relative" v-if="currentUser.isLoggedIn">
|
|
<div>
|
|
<button
|
|
class="max-w-xs flex items-center text-sm rounded-full focus:outline-none focus:shadow-outline"
|
|
id="user-menu"
|
|
aria-label="User menu"
|
|
aria-haspopup="true"
|
|
@click="toggleUserMenu"
|
|
>
|
|
<img
|
|
class="h-8 w-8 rounded-full"
|
|
:src="currentUser.profile.picture || ''"
|
|
alt=""
|
|
/>
|
|
</button>
|
|
</div>
|
|
<!--
|
|
Profile dropdown panel, show/hide based on dropdown state.
|
|
|
|
Entering: "transition ease-out duration-100"
|
|
From: "transform opacity-0 scale-95"
|
|
To: "transform opacity-100 scale-100"
|
|
Leaving: "transition ease-in duration-75"
|
|
From: "transform opacity-100 scale-100"
|
|
To: "transform opacity-0 scale-95"
|
|
-->
|
|
<transition
|
|
enter-active-class="transition ease-out duration-100"
|
|
enter-class="transform opacity-0 scale-95"
|
|
enter-to-class="transform opacity-100 scale-100"
|
|
leave-active-class="transition ease-in duration-75"
|
|
leave-class="transform opacity-100 scale-100"
|
|
leave-to-class="transform opacity-0 scale-95"
|
|
>
|
|
<div
|
|
v-if="userMenuToggled"
|
|
class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg"
|
|
@click="toggleUserMenu"
|
|
>
|
|
<div
|
|
class="rounded-md bg-white shadow-xs"
|
|
role="menu"
|
|
aria-orientation="vertical"
|
|
aria-labelledby="user-menu"
|
|
>
|
|
<div class="py-1">
|
|
<nuxt-link
|
|
to="/profile"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>View profile</nuxt-link
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Settings</a
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Notifications</a
|
|
>
|
|
</div>
|
|
<div class="border-t border-gray-100"></div>
|
|
<div class="py-1">
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Get desktop app</a
|
|
>
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
>Support</a
|
|
>
|
|
</div>
|
|
<div class="border-t border-gray-100"></div>
|
|
<div class="py-1">
|
|
<a
|
|
href="#"
|
|
class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900"
|
|
role="menuitem"
|
|
@click="logout"
|
|
>Logout</a
|
|
>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</transition>
|
|
</div>
|
|
<button v-else>
|
|
<nuxt-link to="/login">Login</nuxt-link>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<main
|
|
class="flex-1 relative z-0 overflow-y-auto focus:outline-none"
|
|
tabindex="0"
|
|
>
|
|
<Nuxt />
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
name: 'Defaultlayout',
|
|
data() {
|
|
return {
|
|
userMenuToggled: false,
|
|
sidebarToggled: false,
|
|
}
|
|
},
|
|
computed: {
|
|
currentUser() {
|
|
return {
|
|
isLoggedIn: this.$store.state.auth.loggedIn,
|
|
token: this.$store.state.auth.token,
|
|
profile: this.$store.state.auth.profile || {picture: ''},
|
|
}
|
|
},
|
|
},
|
|
async mounted() {
|
|
console.log('mounted')
|
|
const loggedIn = await this.$magic.user.isLoggedIn().catch((error) => {
|
|
console.error(error)
|
|
return false
|
|
})
|
|
const token = await this.$magic.user.getIdToken().catch((error) => {
|
|
console.error(error)
|
|
return null
|
|
})
|
|
this.$store.commit('auth/setToken', token)
|
|
if (loggedIn) {
|
|
const profile = await this.$api.$get('/profile').catch(err => {
|
|
console.error(err)
|
|
return null;
|
|
})
|
|
|
|
if (profile) {
|
|
this.$store.commit('auth/setProfile', profile.data)
|
|
const redFrom = this.$store.state.routing.redirectedFrom
|
|
this.$store.commit('routing/setRedirectedFrom', null)
|
|
await this.$router.push(redFrom || '/')
|
|
} else {
|
|
this.$store.commit('auth/setProfile', null)
|
|
await this.$router.push('/')
|
|
}
|
|
}
|
|
this.$store.commit('auth/setLoggedIn', loggedIn)
|
|
},
|
|
methods: {
|
|
toggleUserMenu() {
|
|
this.userMenuToggled = !this.userMenuToggled
|
|
},
|
|
toggleSidebar() {
|
|
this.sidebarToggled = !this.sidebarToggled
|
|
},
|
|
async logout() {
|
|
await this.$magic.user.logout()
|
|
this.$store.commit('auth/setToken', null)
|
|
this.$store.commit('auth/setLoggedIn', false)
|
|
await this.$router.push('/')
|
|
},
|
|
async login() {
|
|
const token = await this.$magic.auth.loginWithMagicLink({
|
|
email: this.email,
|
|
})
|
|
this.$store.commit('auth/setToken', token)
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
html {
|
|
font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI',
|
|
Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
font-size: 16px;
|
|
word-spacing: 1px;
|
|
-ms-text-size-adjust: 100%;
|
|
-webkit-text-size-adjust: 100%;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
-webkit-font-smoothing: antialiased;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
*,
|
|
*::before,
|
|
*::after {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
}
|
|
</style>
|