2018-12-23 13:17:39 +00:00
< template >
< div >
2019-06-27 19:11:44 +01:00
< div class = "w-full fixed top-0 z-30" >
2018-12-25 23:20:12 +00:00
< navbar > < / navbar >
2018-12-23 13:17:39 +00:00
2018-12-25 23:20:12 +00:00
< title-block >
< template slot = "right" >
< header-buttons : links = " [
{ title : 'Add Application' , icon : 'alpha__new-app' , disabled : false } ,
] " > < / header-buttons >
< / template >
< / title-block >
2018-12-23 13:17:39 +00:00
< / div >
2018-12-25 23:20:12 +00:00
< div class = "mt-48" >
2019-06-27 19:11:44 +01:00
< div class = "-mt-3 h-full flex flex-row-reverse" >
< div class = "ml-16 p-4 flex-1 overflow-x-hidden lg:ml-56 lg:p-12" >
2018-12-25 23:20:12 +00:00
< div class = "mb-6" >
< div class = "lg:flex lg:items-baseline mb-12" >
< div class = "mr-16 mb-4 lg:mb-0" >
2019-06-27 19:11:44 +01:00
< h1 class = "mb-2 text-4xl font-thin" > Applications < / h1 >
2018-12-25 23:20:12 +00:00
< / div >
2018-12-23 13:17:39 +00:00
2019-06-27 19:11:44 +01:00
< application-display-switcher class = "mr-3 hidden lg:flex-1 lg:flex lg:justify-end" :mode = "display" @display-changed ="handleDisplay" > < / application-display-switcher >
2018-12-24 08:46:33 +00:00
2019-06-27 19:11:44 +01:00
< div class = "justify-between items-baseline lg:flex lg:flex-row-reverse" >
2018-12-25 23:20:12 +00:00
< div class = "w-full" >
< form action = "#" >
2018-12-26 13:00:21 +00:00
< label for = "applications" class = "visuallyhidden" > Filter applications < / label >
2019-06-27 19:11:44 +01:00
< input id = "applications" type = "text" placeholder = "Filter applications" class = "py-2 px-3 w-full border border-gray-600 rounded" >
2018-12-25 23:20:12 +00:00
< / form >
< / div >
2018-12-23 13:17:39 +00:00
< / div >
< / div >
< / div >
2019-06-27 21:25:01 +01:00
< div class = "-mt-6 -mx-3 flex flex-wrap" >
< div
2018-12-26 01:57:49 +00:00
v - for = "application in sortedApplications"
2018-12-25 23:20:12 +00:00
: key = "application.id"
class = "px-3 w-full"
2019-06-27 21:25:01 +01:00
: class = "{ 'mt-6 flex flex-col md:w-1/2 lg:w-1/3 xl:w-1/4': display == 'grid' }"
>
< application-card
: application = "application"
: display = "display"
: id = "application.id"
2019-07-09 03:06:22 +01:00
class = "flex flex-col flex-1"
2019-06-27 21:25:01 +01:00
> < / application-card >
< / div >
2018-12-25 23:20:12 +00:00
< / div >
2018-12-23 13:17:39 +00:00
< / div >
2019-04-09 13:11:41 +01:00
< sidebar : links = " [
2018-12-25 23:20:12 +00:00
{ title : 'All' , icon : 'alpha__grid' , active : true , disabled : false } ,
{ title : 'Starred' , icon : 'state__starred' , active : false , disabled : false } ,
{ title : 'Recents' , icon : 'objects__recent' , active : false , disabled : false } ,
] " > < / sidebar >
< / div >
2018-12-23 13:17:39 +00:00
< / div >
< / div >
< / template >
< script >
2019-06-25 00:38:04 +01:00
import sortBy from 'lodash/sortBy'
2018-12-26 01:26:09 +00:00
import ApplicationCard from '@/components/Application/ApplicationCard'
import ApplicationDisplaySwitcher from '@/components/Application/ApplicationDisplaySwitcher'
2018-12-23 13:17:39 +00:00
export default {
2019-06-27 12:40:04 +01:00
props : {
applications : {
2019-06-27 21:30:44 +01:00
type : Object ,
2019-06-27 12:40:04 +01:00
required : true
} ,
types : {
type : Object ,
required : true
}
} ,
2019-03-30 08:17:56 +00:00
2018-12-23 13:17:39 +00:00
components : {
ApplicationCard ,
2019-03-30 00:09:48 +00:00
ApplicationDisplaySwitcher
2018-12-23 13:17:39 +00:00
} ,
2019-03-30 00:09:48 +00:00
data ( ) {
2018-12-23 13:17:39 +00:00
return {
2019-03-30 00:09:48 +00:00
display : 'grid'
2018-12-23 13:17:39 +00:00
}
} ,
2018-12-24 08:46:33 +00:00
2018-12-26 01:57:49 +00:00
computed : {
sortedApplications : function ( ) {
2019-06-25 00:38:04 +01:00
return sortBy ( this . applications , [ function ( a ) { return a . name } ] )
2018-12-26 01:57:49 +00:00
}
} ,
2018-12-24 08:46:33 +00:00
methods : {
2019-03-30 00:09:48 +00:00
handleDisplay ( mode ) {
2018-12-24 08:46:33 +00:00
this . display = mode
}
}
2018-12-23 13:17:39 +00:00
}
< / script >