Created theme switcher #270
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import { RouterView } from 'vue-router';
 | 
					import { RouterView } from 'vue-router';
 | 
				
			||||||
import SidebarComponent from '@components/sidebar/SidebarComponent.vue';
 | 
					import SidebarComponent from '@components/sidebar/SidebarComponent.vue';
 | 
				
			||||||
import {onMounted, provide, ref, computed } from 'vue';
 | 
					import {onMounted, provide, ref } from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted( ()=> { switch( localStorage.theme ) {
 | 
					onMounted( ()=> { switch( localStorage.theme ) {
 | 
				
			||||||
@@ -12,13 +12,14 @@ onMounted( ()=> { switch( localStorage.theme ) {
 | 
				
			|||||||
    case "light":{
 | 
					    case "light":{
 | 
				
			||||||
      document.documentElement.classList.remove('dark');
 | 
					      document.documentElement.classList.remove('dark');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } } )
 | 
					  } theme.value = localStorage.theme; }
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const theme = ref( getTheme() );
 | 
					  const theme = ref( getTheme() );
 | 
				
			||||||
  provide('theme', theme );
 | 
					  provide('theme', theme );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function setTheme(newtheme : string){
 | 
					  function setTheme(newTheme : string){
 | 
				
			||||||
    theme.value = newtheme;
 | 
					    theme.value = newTheme;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function getTheme(){
 | 
					  function getTheme(){
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								Frontend/src/assets/dark_theme.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Frontend/src/assets/dark_theme.svg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					<svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" viewBox="0 0 24 24">
 | 
				
			||||||
 | 
					    <path fill="currentColor" d="M17.75,4.09L15.22,6.03L16.13,9.09L13.5,7.28L10.87,9.09L11.78,6.03L9.25,4.09L12.44,4L13.5,1L14.56,4L17.75,4.09M21.25,11L19.61,12.25L20.2,14.23L18.5,13.06L16.8,14.23L17.39,12.25L15.75,11L17.81,10.95L18.5,9L19.19,10.95L21.25,11M18.97,15.95C19.8,15.87 20.69,17.05 20.16,17.8C19.84,18.25 19.5,18.67 19.08,19.07C15.17,23 8.84,23 4.94,19.07C1.03,15.17 1.03,8.83 4.94,4.93C5.34,4.53 5.76,4.17 6.21,3.85C6.96,3.32 8.14,4.21 8.06,5.04C7.79,7.9 8.75,10.87 10.95,13.06C13.14,15.26 16.1,16.22 18.97,15.95M17.33,17.97C14.5,17.81 11.7,16.64 9.53,14.5C7.36,12.31 6.2,9.5 6.04,6.68C3.23,9.82 3.34,14.64 6.35,17.66C9.37,20.67 14.19,20.78 17.33,17.97Z" />
 | 
				
			||||||
 | 
					</svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 768 B  | 
							
								
								
									
										5
									
								
								Frontend/src/assets/light_theme.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Frontend/src/assets/light_theme.svg
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-sun" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
 | 
				
			||||||
 | 
					    <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
 | 
				
			||||||
 | 
					    <circle cx="12" cy="12" r="4"></circle>
 | 
				
			||||||
 | 
					    <path d="M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7"></path>
 | 
				
			||||||
 | 
					</svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 448 B  | 
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import {  ref, onBeforeUpdate, watch, reactive, inject } from 'vue'
 | 
					import { onBeforeUpdate, inject } from 'vue'
 | 
				
			||||||
import { Codemirror } from 'vue-codemirror'
 | 
					import { Codemirror } from 'vue-codemirror'
 | 
				
			||||||
import { oneDark } from '@codemirror/theme-one-dark'
 | 
					import { oneDark } from '@codemirror/theme-one-dark'
 | 
				
			||||||
import { espresso } from 'thememirror';
 | 
					import { espresso } from 'thememirror';
 | 
				
			||||||
@@ -11,7 +11,7 @@ function isDarkModeSet(){
 | 
				
			|||||||
  return localStorage.theme == "dark";
 | 
					  return localStorage.theme == "dark";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const theme :any = inject('theme') ;
 | 
					const theme : string = inject('theme')! ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const props= defineProps({
 | 
					const props= defineProps({
 | 
				
			||||||
  code : {
 | 
					  code : {
 | 
				
			||||||
@@ -30,7 +30,7 @@ const emit = defineEmits(
 | 
				
			|||||||
  ]
 | 
					  ]
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function dataUpdated(newData:String, viewUpdate : any){
 | 
					function dataUpdated(newData:String){
 | 
				
			||||||
  emit('update:updatedCode',newData)
 | 
					  emit('update:updatedCode',newData)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,5 +1,8 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lightThemeIcon from '@/assets/light_theme.svg';
 | 
				
			||||||
 | 
					import darkThemeIcon from '@/assets/dark_theme.svg';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const emit = defineEmits([
 | 
					    const emit = defineEmits([
 | 
				
			||||||
        "theme",
 | 
					        "theme",
 | 
				
			||||||
    ]);
 | 
					    ]);
 | 
				
			||||||
@@ -28,7 +31,7 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
    <div class="mb-4 flex flex-row gap-8">
 | 
					    <div class="mb-4 flex flex-row gap-8">
 | 
				
			||||||
    <button id="header__moon" @click="toDarkMode()" title="Switch to dark mode" class="w-full h-10 focus:outline-none focus:shadow-outline text-gray-500">
 | 
					    <button id="header__moon" @click="toDarkMode()" title="Switch to dark mode" class="w-full h-10 focus:outline-none focus:shadow-outline text-gray-500">
 | 
				
			||||||
        <svg style="width:24px;height:24px" viewBox="0 0 24 24">
 | 
					        <svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" viewBox="0 0 24 24">
 | 
				
			||||||
            <path fill="currentColor" d="M17.75,4.09L15.22,6.03L16.13,9.09L13.5,7.28L10.87,9.09L11.78,6.03L9.25,4.09L12.44,4L13.5,1L14.56,4L17.75,4.09M21.25,11L19.61,12.25L20.2,14.23L18.5,13.06L16.8,14.23L17.39,12.25L15.75,11L17.81,10.95L18.5,9L19.19,10.95L21.25,11M18.97,15.95C19.8,15.87 20.69,17.05 20.16,17.8C19.84,18.25 19.5,18.67 19.08,19.07C15.17,23 8.84,23 4.94,19.07C1.03,15.17 1.03,8.83 4.94,4.93C5.34,4.53 5.76,4.17 6.21,3.85C6.96,3.32 8.14,4.21 8.06,5.04C7.79,7.9 8.75,10.87 10.95,13.06C13.14,15.26 16.1,16.22 18.97,15.95M17.33,17.97C14.5,17.81 11.7,16.64 9.53,14.5C7.36,12.31 6.2,9.5 6.04,6.68C3.23,9.82 3.34,14.64 6.35,17.66C9.37,20.67 14.19,20.78 17.33,17.97Z" />
 | 
					            <path fill="currentColor" d="M17.75,4.09L15.22,6.03L16.13,9.09L13.5,7.28L10.87,9.09L11.78,6.03L9.25,4.09L12.44,4L13.5,1L14.56,4L17.75,4.09M21.25,11L19.61,12.25L20.2,14.23L18.5,13.06L16.8,14.23L17.39,12.25L15.75,11L17.81,10.95L18.5,9L19.19,10.95L21.25,11M18.97,15.95C19.8,15.87 20.69,17.05 20.16,17.8C19.84,18.25 19.5,18.67 19.08,19.07C15.17,23 8.84,23 4.94,19.07C1.03,15.17 1.03,8.83 4.94,4.93C5.34,4.53 5.76,4.17 6.21,3.85C6.96,3.32 8.14,4.21 8.06,5.04C7.79,7.9 8.75,10.87 10.95,13.06C13.14,15.26 16.1,16.22 18.97,15.95M17.33,17.97C14.5,17.81 11.7,16.64 9.53,14.5C7.36,12.31 6.2,9.5 6.04,6.68C3.23,9.82 3.34,14.64 6.35,17.66C9.37,20.67 14.19,20.78 17.33,17.97Z" />
 | 
				
			||||||
        </svg>
 | 
					        </svg>
 | 
				
			||||||
    </button>
 | 
					    </button>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import JsonButtonFormatterComponent from '@/components/formatter/JsonButtonForma
 | 
				
			|||||||
import HtmlButtonFormatterComponent from '@/components/formatter/HtmlButtonFormatterComponent.vue';
 | 
					import HtmlButtonFormatterComponent from '@/components/formatter/HtmlButtonFormatterComponent.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue';
 | 
					import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue';
 | 
				
			||||||
import CodeEditorComponent from '@/components/CodeEditorComponent.vue';
 | 
					import CodeEditorComponent from '@/components/common/CodeEditorComponent.vue';
 | 
				
			||||||
import { ref } from 'vue';
 | 
					import { ref } from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import CodeEditorComponent from '../CodeEditorComponent.vue';
 | 
					import CodeEditorComponent from '@/components/common/CodeEditorComponent.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const props = defineProps(
 | 
					const props = defineProps(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
import {ref, type Ref} from 'vue';
 | 
					import {ref, type Ref} from 'vue';
 | 
				
			||||||
import HeadersComponent from './HeadersComponent.vue';
 | 
					import HeadersComponent from './HeadersComponent.vue';
 | 
				
			||||||
import SaveComponent from './SaveComponent.vue';
 | 
					import SaveComponent from './SaveComponent.vue';
 | 
				
			||||||
import CodeEditorComponent from '../CodeEditorComponent.vue';
 | 
					import CodeEditorComponent from '@/components/common/CodeEditorComponent.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const clientUUID = ref('');
 | 
					const clientUUID = ref('');
 | 
				
			||||||
const host = window.location.protocol + "//" + window.location.hostname + "/mock";
 | 
					const host = window.location.protocol + "//" + window.location.hostname + "/mock";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,18 +22,8 @@ function isDarkModeSet(){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function changeTheme(theme:string){
 | 
					function changeTheme(theme:string){
 | 
				
			||||||
    switch (theme){
 | 
					 | 
				
			||||||
        case "dark":{
 | 
					 | 
				
			||||||
            changeLogoForTheme()
 | 
					            changeLogoForTheme()
 | 
				
			||||||
            emit('theme:changed',theme);
 | 
					            emit('theme:changed',theme);
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        case "light":{
 | 
					 | 
				
			||||||
            changeLogoForTheme()
 | 
					 | 
				
			||||||
            emit('theme:changed',theme);
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
onMounted( () => {
 | 
					onMounted( () => {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue'
 | 
					import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue'
 | 
				
			||||||
import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue'
 | 
					import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue'
 | 
				
			||||||
import { ref } from 'vue'
 | 
					import { ref } from 'vue'
 | 
				
			||||||
import CodeEditor from '../CodeEditorComponent.vue'
 | 
					import CodeEditor from '@/components/common/CodeEditorComponent.vue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const data = ref('')
 | 
					const data = ref('')
 | 
				
			||||||
const inputFile = ref()
 | 
					const inputFile = ref()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import { onMounted, ref } from 'vue';
 | 
					import { onMounted, ref } from 'vue';
 | 
				
			||||||
import CodeEditor from '../CodeEditorComponent.vue';
 | 
					import CodeEditor from '@/components/common/CodeEditorComponent.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const props = defineProps(
 | 
					const props = defineProps(
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import CodeEditorComponent from '@/components/CodeEditorComponent.vue'
 | 
					import CodeEditorComponent from '@/components/common/CodeEditorComponent.vue'
 | 
				
			||||||
import EncoderButton from '@/components/encoder/EncoderButtonComponent.vue'
 | 
					import EncoderButton from '@/components/encoder/EncoderButtonComponent.vue'
 | 
				
			||||||
import { ref } from 'vue'
 | 
					import { ref } from 'vue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
import { ref } from 'vue';
 | 
					import { ref } from 'vue';
 | 
				
			||||||
import EncodeUriButton from '@components/encoder/EncodeUriButtonComponent.vue'
 | 
					import EncodeUriButton from '@components/encoder/EncodeUriButtonComponent.vue'
 | 
				
			||||||
import CodeEditorComponent from '@/components/CodeEditorComponent.vue';
 | 
					import CodeEditorComponent from '@/components/common/CodeEditorComponent.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const uri = ref("")
 | 
					const uri = ref("")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user