-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
155 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true, | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<template> | ||
<div> | ||
<navbar /> | ||
<div class="mb-1 mt-10"> | ||
<div class="bg-gray-100"> | ||
<div class="px-4 py-8 mx-auto sm:max-w-xl md:max-w-full lg:max-w-screen-xl md:px-24 lg:px-8 lg:py-8"> | ||
<div class="max-w-xl md:mx-auto sm:text-center lg:max-w-2xl"> | ||
<div> | ||
<p | ||
class="inline-block px-3 py-1 mb-4 text-xs font-bold tracking-wider text-white rounded-full bg-simplydiarynew-primary"> | ||
Diary Code: {{ this.diary.code }} </p> | ||
</div> | ||
<h2 | ||
class="max-w-lg mb-2 font-sans text-6xl font-extrabold leading-none tracking-wide text-gray-900 sm:text-6xl md:mx-auto"> | ||
Your Diary Settings | ||
</h2> | ||
<div class="flex items-center sm:justify-center"> | ||
<a :href="`${this.backurl}`" aria-label="" | ||
class="inline-flex items-center font-semibold text-gray-700 transition-colors duration-200 hover:text-simplydiarynew-primary">Back | ||
to Diary</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="px-4 py-8 mx-auto sm:max-w-xl md:max-w-full lg:max-w-screen-xl md:px-24 lg:px-8 lg:py-16"> | ||
<div class="max-w-screen-lg sm:mx-auto"> | ||
<form class="col-lg-12 text-start mt-5" @submit.prevent="saveSettings"> | ||
<label class="block"> | ||
<span class="text-black font-bold font-nunito text-xl">Title</span> | ||
<input type="text" class="form-input mt-1 block w-full rounded border" v-model="title" required> | ||
|
||
<button type="submit" | ||
class="inline-flex items-center mt-4 h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md bg-blue-gray-900 hover:bg-gray-700 focus:shadow-outline focus:outline-none"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" | ||
class="mr-2 bi bi-check-circle-fill" viewBox="0 0 16 16"> | ||
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" /> | ||
<path | ||
d="M10.97 4.97a.235.235 0 0 0-.02.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05z" /> | ||
</svg> Save Settings | ||
</button> | ||
<button | ||
class="inline-flex items-center ml-2 mt-4 h-12 px-6 font-medium tracking-wide text-white transition duration-200 rounded shadow-md bg-simplydiarynew-primary hover:bg-simplydiarynew-secondary focus:shadow-outline focus:outline-none"> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" | ||
class="bi bi-trash mr-2" viewBox="0 0 16 16"> | ||
<path | ||
d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z" /> | ||
<path fill-rule="evenodd" | ||
d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z" /> | ||
</svg> Delete Diary | ||
</button> | ||
</label> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
<footer-lp /> | ||
</div> | ||
</template> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Nunito&display=swap'); | ||
|
||
body { | ||
background-color: #F5F4F4 !important; | ||
} | ||
|
||
.font-nunito { | ||
font-family: "Nunito", sans-serif !important; | ||
} | ||
|
||
</style> | ||
<script lang="ts"> | ||
import Vue from "vue"; | ||
|
||
|
||
export default Vue.extend({ | ||
data() { | ||
return { | ||
diary: {}, | ||
backurl: "", | ||
title: "" | ||
}; | ||
}, | ||
|
||
methods: { | ||
async saveSettings() { | ||
try { | ||
var updatedSettings = await this.$axios.post("https://api.simply-diary.xyz/v1/diarys/" + this.$nuxt | ||
.context | ||
.params | ||
.slug, { | ||
title: this.title | ||
}); | ||
|
||
console.log(updatedSettings) | ||
|
||
this.diary = updatedSettings.data; | ||
this.$router.push(`/diarys/${this.$nuxt.context | ||
.params | ||
.slug}`) | ||
|
||
} catch (err) { | ||
console.log("error" + err); | ||
this.$nuxt.context.error({ | ||
statusCode: 502, | ||
message: "Internal Server Error" | ||
}); | ||
} | ||
|
||
} | ||
}, | ||
|
||
|
||
mounted: async function () { | ||
try { | ||
var fetchedDiary = await this.$axios.get("https://api.simply-diary.xyz/v1/diarys/" + this.$nuxt.context | ||
.params | ||
.slug) | ||
this.diary = fetchedDiary.data; | ||
this.title = fetchedDiary.data.title; | ||
this.backurl = "https://simply-diary.xyz/diarys/" + fetchedDiary.data.code; | ||
} catch (err) { | ||
console.log("error" + err); | ||
this.$nuxt.context.error({ | ||
statusCode: 404, | ||
message: "Page not found" | ||
}); | ||
} | ||
} | ||
}); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters