Skip to content

Commit

Permalink
Format files with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-daneshvar committed Feb 5, 2023
1 parent 7113059 commit 6dc5ab3
Show file tree
Hide file tree
Showing 17 changed files with 1,927 additions and 1,812 deletions.
48 changes: 24 additions & 24 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "chartello/poc",
"autoload": {
"psr-4": {
"Chartello\\Lite\\": "src/"
}
},
"authors": [
{
"name": "Matt Daneshvar",
"email": "matt.daneshvar@gmail.com"
}
],
"require-dev": {
"inertiajs/inertia-laravel": "^0.6.9",
"illuminate/database": "^9.50",
"illuminate/support": "^9.50",
"laravel/pint": "^1.4"
},
"extra": {
"laravel": {
"providers": [
"Chartello\\Lite\\ChartelloServiceProvider"
]
}
"name": "chartello/poc",
"autoload": {
"psr-4": {
"Chartello\\Lite\\": "src/"
}
},
"authors": [
{
"name": "Matt Daneshvar",
"email": "matt.daneshvar@gmail.com"
}
],
"require-dev": {
"inertiajs/inertia-laravel": "^0.6.9",
"illuminate/database": "^9.50",
"illuminate/support": "^9.50",
"laravel/pint": "^1.4"
},
"extra": {
"laravel": {
"providers": [
"Chartello\\Lite\\ChartelloServiceProvider"
]
}
}
}
2,554 changes: 1,277 additions & 1,277 deletions package-lock.json

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
{
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.13",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.4.21",
"prettier": "^2.8.3",
"prettier-plugin-tailwindcss": "^0.2.2",
"tailwindcss": "^3.2.4",
"vite": "^4.0.0"
},
"dependencies": {
"@headlessui/vue": "^1.7.8",
"@inertiajs/vue3": "^1.0.0",
"@tailwindcss/forms": "^0.5.3",
"@vitejs/plugin-vue": "^4.0.0",
"apexcharts": "^3.36.3",
"codejar": "^3.6.0",
"highlight.js": "^11.7.0",
"v-calendar": "^3.0.0-alpha.8",
"vue": "^3.2.45",
"vue-tabler-icons": "^2.19.0"
}
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"autoprefixer": "^10.4.13",
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.4.21",
"prettier": "^2.8.3",
"prettier-plugin-tailwindcss": "^0.2.2",
"tailwindcss": "^3.2.4",
"vite": "^4.0.0"
},
"dependencies": {
"@headlessui/vue": "^1.7.8",
"@inertiajs/vue3": "^1.0.0",
"@tailwindcss/forms": "^0.5.3",
"@vitejs/plugin-vue": "^4.0.0",
"apexcharts": "^3.36.3",
"codejar": "^3.6.0",
"highlight.js": "^11.7.0",
"v-calendar": "^3.0.0-alpha.8",
"vue": "^3.2.45",
"vue-tabler-icons": "^2.19.0"
}
}
2 changes: 1 addition & 1 deletion postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
}
};
146 changes: 78 additions & 68 deletions resources/js/Components/Dashboards/Link.vue
Original file line number Diff line number Diff line change
@@ -1,94 +1,104 @@
<template>
<form
method="POST"
class="flex items-center text-blue-900 px-4 mb-2 rounded-lg transition"
:class="{ 'bg-blue-100': active, ' hover:bg-gray-100': !active }"
@submit.prevent="update"
>
<input
v-if="editing"
type="text"
v-model="form.name"
ref="input"
placeholder="Untitled"
class="flex-1 w-full py-2 border-0 p-0 bg-transparent underline underline-offset-4 decoration-gray-200 focus:decoration-blue-200 focus:ring-0">
<Link
v-else
class="flex-1 py-2"
:href="`/${$page.props.path}/dashboards/${dashboard.id}`"
v-text="form.name ? form.name : 'Untitled'"
/>

<template v-if="active">
<IconButton v-if="editing && !form.processing" @click="remove" type="button" class="text-red-400 mr-1 hover:bg-red-100">
<TrashIcon class="w-4 h-4"/>
</IconButton>

<Spinner v-if="form.processing" class="ml-2"/>

<IconButton v-else-if="editing" @click="update" class="text-blue-500 hover:bg-blue-200">
<CheckIcon class="w-4 h-4"/>
</IconButton>

<IconButton v-else @click="edit" class="text-blue-500 hover:bg-blue-200">
<PencilIcon class="w-4 h-4"/>
</IconButton>
</template>
</form>
<form
method="POST"
class="mb-2 flex items-center rounded-lg px-4 text-blue-900 transition"
:class="{ 'bg-blue-100': active, ' hover:bg-gray-100': !active }"
@submit.prevent="update"
>
<input
v-if="editing"
type="text"
v-model="form.name"
ref="input"
placeholder="Untitled"
class="w-full flex-1 border-0 bg-transparent p-0 py-2 underline decoration-gray-200 underline-offset-4 focus:decoration-blue-200 focus:ring-0"
/>
<Link
v-else
class="flex-1 py-2"
:href="`/${$page.props.path}/dashboards/${dashboard.id}`"
v-text="form.name ? form.name : 'Untitled'"
/>

<template v-if="active">
<IconButton
v-if="editing && !form.processing"
@click="remove"
type="button"
class="mr-1 text-red-400 hover:bg-red-100"
>
<TrashIcon class="h-4 w-4" />
</IconButton>

<Spinner v-if="form.processing" class="ml-2" />

<IconButton
v-else-if="editing"
@click="update"
class="text-blue-500 hover:bg-blue-200"
>
<CheckIcon class="h-4 w-4" />
</IconButton>

<IconButton v-else @click="edit" class="text-blue-500 hover:bg-blue-200">
<PencilIcon class="h-4 w-4" />
</IconButton>
</template>
</form>
</template>

<script setup>
import {Link, useForm, usePage} from '@inertiajs/vue3'
import { PencilIcon, CheckIcon, TrashIcon } from "vue-tabler-icons"
import {computed, onMounted, ref, watch} from 'vue'
import Spinner from '../Spinner.vue'
import IconButton from '../IconButton.vue'
import { Link, useForm, usePage } from "@inertiajs/vue3";
import { PencilIcon, CheckIcon, TrashIcon } from "vue-tabler-icons";
import { computed, onMounted, ref, watch } from "vue";
import Spinner from "../Spinner.vue";
import IconButton from "../IconButton.vue";
const props = defineProps(['dashboard'])
const props = defineProps(["dashboard"]);
const editing = ref(false)
const editing = ref(false);
const active = computed(() => {
let url = usePage().url
let url = usePage().url;
url = url.indexOf('?') === -1 ? url : url.substring(0, url.indexOf('?'))
url = url.indexOf("?") === -1 ? url : url.substring(0, url.indexOf("?"));
return url === `/${usePage().props.path}/dashboards/${props.dashboard.id}`
})
return url === `/${usePage().props.path}/dashboards/${props.dashboard.id}`;
});
const form = useForm({
name: ref(props.dashboard.name),
})
name: ref(props.dashboard.name),
});
const input = ref(null)
const input = ref(null);
function edit() {
editing.value = true
setTimeout(() => input.value.focus(), 50)
editing.value = true;
setTimeout(() => input.value.focus(), 50);
}
function update() {
form.put(`/${usePage().props.path}/dashboards/${props.dashboard.id}`, {
preserveScroll: true,
onSuccess: () => editing.value = false
})
form.put(`/${usePage().props.path}/dashboards/${props.dashboard.id}`, {
preserveScroll: true,
onSuccess: () => (editing.value = false),
});
}
function remove() {
form.delete(`/${usePage().props.path}/dashboards/${props.dashboard.id}`, {
preserveScroll: true
})
form.delete(`/${usePage().props.path}/dashboards/${props.dashboard.id}`, {
preserveScroll: true,
});
}
watch(active, value => {
if(!value) {
editing.value = false
}
})
watch(active, (value) => {
if (!value) {
editing.value = false;
}
});
onMounted(() => {
if(active.value && props.dashboard.name === null) {
edit()
}
})
if (active.value && props.dashboard.name === null) {
edit();
}
});
</script>
Loading

0 comments on commit 6dc5ab3

Please sign in to comment.