diff --git a/docs/background.js b/docs/background.js index e69de29..5f60bbc 100644 --- a/docs/background.js +++ b/docs/background.js @@ -0,0 +1,25 @@ +console.log("background.js loaded!"); + +chrome.alarms.onAlarm.addListener((alarm) => { + console.log("Alarm!!!"); + const id = alarm.name; + chrome.storage.local.get(["todos"]).then((result) => { + for (index in result.todos) { + if (id === result.todos[index].id.toString()) { + const message = result.todos[index].title; + chrome.notifications.create(id.toString(), { + type: "basic", + iconUrl: "logo.png", + title: "์จ, ์ผํด", + message: message ? message : "๐ณ์ ๋ชฉ ์์๐ณ", + priority: 2, + }); + if (result.todos[index].link !== null) { + chrome.tabs.create({ + url: result.todos[index].link, + }); + } + } + } + }); +}); diff --git a/docs/css/app.14708914.css b/docs/css/app.14708914.css new file mode 100644 index 0000000..6af57b1 --- /dev/null +++ b/docs/css/app.14708914.css @@ -0,0 +1 @@ +:root{--green-blue:#01af94;--aqua-marine:#34e8cd;--light-grey-blue:#a4c9c3;--warm-grey:#707070;--ice-blue:#ebfffc}*{font-family:Pretendard Variable,Pretendard,-apple-system,BlinkMacSystemFont,system-ui,Roboto,Helvetica Neue,Segoe UI,Apple SD Gothic Neo,Noto Sans KR,Malgun Gothic,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body,html{height:100%}body{margin:0}#app{height:100%;color:#2c3e50}.container[data-v-25e94a08]{height:100%;margin:0 7%;display:flex;flex-direction:column}button[data-v-25e94a08]:hover{cursor:pointer}nav[data-v-25e94a08]{margin-top:3.5rem;margin-bottom:3.7rem}form[data-v-25e94a08]{flex:1}.btn-prev[data-v-25e94a08]{padding:0;background:transparent;border:none}.day[data-v-25e94a08]{display:block;font-family:Pretendard;font-size:.938rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:normal;color:var(--green-blue)}.second-line[data-v-25e94a08]{display:flex;justify-content:space-between;align-items:center;margin-bottom:5.3%}.time[data-v-25e94a08]{display:inline-block;font-size:3rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:1.17;letter-spacing:normal;border:none;color:var(--green-blue)}input[type=time][data-v-25e94a08]::-webkit-calendar-picker-indicator{filter:invert(48%) sepia(13%) saturate(3207%) hue-rotate(130deg) brightness(95%) contrast(80%)}.btn-noti[data-v-25e94a08]{border:none;background:transparent}.btn-noti svg[data-v-25e94a08]{fill:#01af94;width:1.368rem;height:1.563rem}label[data-v-25e94a08]{margin-bottom:.5rem;display:block;font-size:.813rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.15;letter-spacing:normal;color:var(--green-blue)}input[type=text][data-v-25e94a08],input[type=url][data-v-25e94a08]{width:100%;margin-bottom:1.3rem;padding:1rem;border-radius:15px;border:solid .5px var(--aqua-marine);background-color:var(--ice-blue);font-size:1rem;font-weight:600;color:var(--green-blue)}input[data-v-25e94a08]::-moz-placeholder{font-size:.875rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.14;letter-spacing:normal;color:var(--light-grey-blue)}input[data-v-25e94a08]::placeholder{font-size:.875rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.14;letter-spacing:normal;color:var(--light-grey-blue)}input[data-v-25e94a08]:focus{outline-color:var(--green-blue)}.btn-delete[data-v-25e94a08]{min-height:3.188rem;font-size:1rem;font-weight:600;border:none;border-radius:15px;background-color:var(--green-blue);color:var(--ice-blue);margin-bottom:3.5rem}.empty-todo[data-v-c4aecc44]{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center}p[data-v-c4aecc44]{margin:0;font-family:Pretendard;font-size:.938rem;font-weight:300;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:.03px;text-align:center;color:#707070}button[data-v-c4aecc44]{margin-top:.6%;padding:0;background:transparent;border:none}button[data-v-c4aecc44]:hover{cursor:pointer}ul[data-v-63851ebe]{margin:0;padding:0 1.25rem;list-style:none;overflow:scroll}input[type=checkbox][data-v-63851ebe]{accent-color:var(--green-blue);cursor:pointer}time[data-v-63851ebe]{font-size:1.25rem;font-weight:600;line-height:1.2;color:var(--green-blue)}.done[data-v-63851ebe]{text-decoration:line-through;color:#b9b9b9}.second-line[data-v-63851ebe]{display:flex;justify-content:space-between;margin:.563rem 0 .938rem 0}.title[data-v-63851ebe]{font-size:1rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.19;letter-spacing:normal;text-align:center;color:var(--warm-grey)}.btn-noti svg[data-v-63851ebe]{fill:var(--green-blue);width:.984rem;height:1.125rem}button[data-v-63851ebe]{padding:0 .4rem;background:none;border:none}button[data-v-63851ebe]:hover{cursor:pointer}.link[data-v-63851ebe]{margin:0;font-size:.625rem;font-weight:100;font-stretch:normal;font-style:normal;line-height:1.1;letter-spacing:normal;color:#b9b9b9}hr[data-v-63851ebe]{border:solid 1px var(--light-grey-blue)}.btn-add[data-v-63851ebe]{flex:0}.container[data-v-57cf2e1d]{flex:1;width:100%;max-height:100%;display:flex;flex-direction:column;align-items:center;overflow:hidden}.date[data-v-57cf2e1d]{margin-top:2.891rem;margin-bottom:1.125rem;padding-left:1rem;width:90.5%;font-size:1.25rem;font-weight:800;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:normal;color:var(--green-blue);text-align:left}.box[data-v-57cf2e1d]{flex:1;display:flex;flex-direction:column;width:90.5%;padding:1.5rem 0;margin-bottom:2rem;border-radius:15px;box-shadow:0 3px 6px 0 rgba(0,0,0,.16);background-color:#fff;overflow-y:auto;overflow-x:visible}ul[data-v-57cf2e1d]{flex:1;margin:0;padding:0 1.25rem;list-style:none;overflow:scroll}time[data-v-57cf2e1d]{font-size:1.25rem;font-weight:600;line-height:1.2;color:var(--green-blue)}.second-line[data-v-57cf2e1d]{display:flex;justify-content:space-between;margin:.563rem 0 .938rem 0}.title[data-v-57cf2e1d]{font-size:1rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.19;letter-spacing:normal;text-align:center;color:var(--warm-grey)}button[data-v-57cf2e1d]{padding:.4rem .4rem 0 .4rem;background:none;border:none}button[data-v-57cf2e1d]:hover{cursor:pointer}.link[data-v-57cf2e1d]{margin:0;font-size:.625rem;font-weight:100;font-stretch:normal;font-style:normal;line-height:1.1;letter-spacing:normal;color:#b9b9b9}hr[data-v-57cf2e1d]{border:solid 1px var(--light-grey-blue)}.btn-add[data-v-57cf2e1d]{flex:0}button[data-v-1120511c]:hover{cursor:pointer}.wrapper[data-v-1120511c]{width:inherit;height:inherit;display:flex;flex-direction:column;align-items:center;background-color:#f8fffe}.calendar[data-v-1120511c]{margin:3.904rem 0 0 0;width:90.7%;border-radius:15px;background-color:#fff;box-shadow:0 3px 6px 0 rgba(0,0,0,.16)}.year[data-v-1120511c]{font-size:1.125rem;font-weight:600;line-height:1.17;margin:1.705rem 0 0 5.6%}.month[data-v-1120511c],.year[data-v-1120511c]{font-family:Pretendard;font-stretch:normal;font-style:normal;letter-spacing:normal;color:#01af94}.month[data-v-1120511c]{font-size:1.563rem;font-weight:900;line-height:1.2;margin-left:5.4%;display:inline-block}.btn-container[data-v-1120511c]{display:flex;justify-content:space-between;float:right;width:2.3rem;margin-right:7.3%}.btn-container button[data-v-1120511c]{background:transparent;border:none;padding:0;fill:#000}.btn-container button[data-v-1120511c]:disabled{fill:#707070}.days li[data-v-1120511c]{font-size:.875rem}.days[data-v-1120511c]{list-style:none;padding:0;display:grid;margin-top:.922rem;margin-left:1rem;margin-right:1rem;margin-bottom:1.938rem;grid-template-columns:repeat(7,1fr);text-align:center;row-gap:1.8rem}.disabled[data-v-1120511c]{color:var(--warm-grey)}.active[data-v-1120511c]{color:var(--green-blue);border:none;background:none;font-weight:500}.selected button[data-v-1120511c]{position:relative;font-weight:800;z-index:10}.selected[data-v-1120511c]{display:inline-table;position:relative}.selected[data-v-1120511c]:before{position:absolute;content:"";height:2.063rem;width:2.063rem;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#defffa;border-radius:5px;border:solid 1px var(--green-blue);z-index:9}.weeks[data-v-1120511c]{list-style:none;display:grid;grid-template-columns:repeat(7,1fr);text-align:center;padding:0;margin-top:2.436rem;margin-left:1rem;margin-right:1rem;color:#a4beba}.weeks li[data-v-1120511c]{font-size:.813rem;float:left}.wrapper[data-v-2cb6f04f]{width:inherit;height:inherit;display:flex;flex-direction:column;align-items:center;background-color:#f8fffe}header[data-v-3ccde9be]{font-size:1.875rem;font-weight:800;color:var(--green-blue);margin-top:.875rem;margin-bottom:1.688rem}.wrapper[data-v-3ccde9be]{display:flex;flex-direction:column;height:100%}nav[data-v-3ccde9be]{margin:0 7%}.btn-prev[data-v-3ccde9be]{margin:3.5rem 0 0 0;border:none;background:none}.btn-prev[data-v-3ccde9be]:hover{cursor:pointer}ul[data-v-3ccde9be]{padding:0 7%;overflow-y:scroll} \ No newline at end of file diff --git a/docs/css/app.56f205ac.css b/docs/css/app.56f205ac.css deleted file mode 100644 index 8856b5a..0000000 --- a/docs/css/app.56f205ac.css +++ /dev/null @@ -1 +0,0 @@ -:root{--green-blue:#01af94;--aqua-marine:#34e8cd;--light-grey-blue:#a4c9c3;--warm-grey:#707070;--ice-blue:#ebfffc}*{font-family:Pretendard Variable,Pretendard,-apple-system,BlinkMacSystemFont,system-ui,Roboto,Helvetica Neue,Segoe UI,Apple SD Gothic Neo,Noto Sans KR,Malgun Gothic,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;box-sizing:border-box}body,html{height:100%}body{margin:0}#app{height:100%;color:#2c3e50}.container[data-v-759a700e]{height:100%;margin:0 7%;display:flex;flex-direction:column}button[data-v-759a700e]:hover{cursor:pointer}nav[data-v-759a700e]{margin-top:3.5rem;margin-bottom:3.7rem}form[data-v-759a700e]{flex:1}.btn-prev[data-v-759a700e]{padding:0;background:transparent;border:none}.day[data-v-759a700e]{display:block;font-family:Pretendard;font-size:.938rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:normal;color:var(--green-blue)}.second-line[data-v-759a700e]{display:flex;justify-content:space-between;align-items:center;margin-bottom:5.3%}.time[data-v-759a700e]{display:inline-block;font-size:3rem;font-weight:700;font-stretch:normal;font-style:normal;line-height:1.17;letter-spacing:normal;border:none;color:var(--green-blue)}input[type=time][data-v-759a700e]::-webkit-calendar-picker-indicator{filter:invert(48%) sepia(13%) saturate(3207%) hue-rotate(130deg) brightness(95%) contrast(80%)}.btn-noti[data-v-759a700e]{border:none;background:transparent}.btn-noti svg[data-v-759a700e]{fill:#01af94;width:1.368rem;height:1.563rem}label[data-v-759a700e]{margin-bottom:.5rem;display:block;font-size:.813rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.15;letter-spacing:normal;color:var(--green-blue)}input[type=link][data-v-759a700e],input[type=text][data-v-759a700e]{width:100%;margin-bottom:1.3rem;padding:1rem;border-radius:15px;border:solid .5px var(--aqua-marine);background-color:var(--ice-blue);font-size:1rem;font-weight:600;color:var(--green-blue)}input[data-v-759a700e]::-moz-placeholder{font-size:.875rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.14;letter-spacing:normal;color:var(--light-grey-blue)}input[data-v-759a700e]::placeholder{font-size:.875rem;font-weight:200;font-stretch:normal;font-style:normal;line-height:1.14;letter-spacing:normal;color:var(--light-grey-blue)}input[data-v-759a700e]:focus{outline-color:var(--green-blue)}.btn-delete[data-v-759a700e]{min-height:3.188rem;font-size:1rem;font-weight:600;border:none;border-radius:15px;background-color:var(--green-blue);color:var(--ice-blue);margin-bottom:3.5rem}.empty-todo[data-v-c4aecc44]{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center}p[data-v-c4aecc44]{margin:0;font-family:Pretendard;font-size:.938rem;font-weight:300;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:.03px;text-align:center;color:#707070}button[data-v-c4aecc44]{margin-top:.6%;padding:0;background:transparent;border:none}button[data-v-c4aecc44]:hover{cursor:pointer}ul[data-v-247731be]{margin:0;padding:0 1.25rem;list-style:none;overflow:scroll}time[data-v-247731be]{font-size:1.25rem;font-weight:600;line-height:1.2;color:var(--green-blue)}.second-line[data-v-247731be]{display:flex;justify-content:space-between;margin:.563rem 0 .938rem 0}.title[data-v-247731be]{font-size:1rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.19;letter-spacing:normal;text-align:center;color:var(--warm-grey)}.btn-noti svg[data-v-247731be]{fill:var(--green-blue);width:.984rem;height:1.125rem}button[data-v-247731be]{padding:0 .4rem;background:none;border:none}button[data-v-247731be]:hover{cursor:pointer}.link[data-v-247731be]{margin:0;font-size:.625rem;font-weight:100;font-stretch:normal;font-style:normal;line-height:1.1;letter-spacing:normal;color:#b9b9b9}hr[data-v-247731be]{border:solid 1px var(--light-grey-blue)}.btn-add[data-v-247731be]{flex:0}.container[data-v-23cafdf7]{flex:1;width:100%;max-height:100%;display:flex;flex-direction:column;align-items:center;overflow:hidden}.date[data-v-23cafdf7]{margin-top:2.891rem;margin-bottom:1.125rem;padding-left:1rem;width:90.5%;font-size:1.25rem;font-weight:800;font-stretch:normal;font-style:normal;line-height:1.2;letter-spacing:normal;color:var(--green-blue);text-align:left}.box[data-v-23cafdf7]{flex:1;display:flex;flex-direction:column;width:90.5%;padding:1.5rem 0;margin-bottom:2rem;border-radius:15px;box-shadow:0 3px 6px 0 rgba(0,0,0,.16);background-color:#fff;overflow-y:auto;overflow-x:visible}.box[data-v-23cafdf7]:hover{cursor:pointer}ul[data-v-23cafdf7]{margin:0;padding:0 1.25rem;list-style:none;overflow:scroll}time[data-v-23cafdf7]{font-size:1.25rem;font-weight:600;line-height:1.2;color:var(--green-blue)}.second-line[data-v-23cafdf7]{display:flex;justify-content:space-between;margin:.563rem 0 .938rem 0}.title[data-v-23cafdf7]{font-size:1rem;font-weight:400;font-stretch:normal;font-style:normal;line-height:1.19;letter-spacing:normal;text-align:center;color:var(--warm-grey)}button[data-v-23cafdf7]{padding:0 .4rem;background:none;border:none}button[data-v-23cafdf7]:hover{cursor:pointer}.link[data-v-23cafdf7]{margin:0;font-size:.625rem;font-weight:100;font-stretch:normal;font-style:normal;line-height:1.1;letter-spacing:normal;color:#b9b9b9}hr[data-v-23cafdf7]{border:solid 1px var(--light-grey-blue)}.btn-add[data-v-23cafdf7]{flex:0}button[data-v-1120511c]:hover{cursor:pointer}.wrapper[data-v-1120511c]{width:inherit;height:inherit;display:flex;flex-direction:column;align-items:center;background-color:#f8fffe}.calendar[data-v-1120511c]{margin:3.904rem 0 0 0;width:90.7%;border-radius:15px;background-color:#fff;box-shadow:0 3px 6px 0 rgba(0,0,0,.16)}.year[data-v-1120511c]{font-size:1.125rem;font-weight:600;line-height:1.17;margin:1.705rem 0 0 5.6%}.month[data-v-1120511c],.year[data-v-1120511c]{font-family:Pretendard;font-stretch:normal;font-style:normal;letter-spacing:normal;color:#01af94}.month[data-v-1120511c]{font-size:1.563rem;font-weight:900;line-height:1.2;margin-left:5.4%;display:inline-block}.btn-container[data-v-1120511c]{display:flex;justify-content:space-between;float:right;width:2.3rem;margin-right:7.3%}.btn-container button[data-v-1120511c]{background:transparent;border:none;padding:0;fill:#000}.btn-container button[data-v-1120511c]:disabled{fill:#707070}.days li[data-v-1120511c]{font-size:.875rem}.days[data-v-1120511c]{list-style:none;padding:0;display:grid;margin-top:.922rem;margin-left:1rem;margin-right:1rem;margin-bottom:1.938rem;grid-template-columns:repeat(7,1fr);text-align:center;row-gap:1.8rem}.disabled[data-v-1120511c]{color:var(--warm-grey)}.active[data-v-1120511c]{color:var(--green-blue);border:none;background:none;font-weight:500}.selected button[data-v-1120511c]{position:relative;font-weight:800;z-index:10}.selected[data-v-1120511c]{display:inline-table;position:relative}.selected[data-v-1120511c]:before{position:absolute;content:"";height:2.063rem;width:2.063rem;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#defffa;border-radius:5px;border:solid 1px var(--green-blue);z-index:9}.weeks[data-v-1120511c]{list-style:none;display:grid;grid-template-columns:repeat(7,1fr);text-align:center;padding:0;margin-top:2.436rem;margin-left:1rem;margin-right:1rem;color:#a4beba}.weeks li[data-v-1120511c]{font-size:.813rem;float:left}.wrapper[data-v-2cb6f04f]{width:inherit;height:inherit;display:flex;flex-direction:column;align-items:center;background-color:#f8fffe}header[data-v-e7c8c134]{font-size:1.875rem;font-weight:800;color:var(--green-blue);margin-top:1.3%;margin-bottom:2.5%}.wrapper[data-v-e7c8c134]{padding-top:5.1%;padding-left:7.9%;padding-right:7.9%}.btn-prev[data-v-e7c8c134]{border:none;background:none}.btn-prev[data-v-e7c8c134]:hover{cursor:pointer}ul[data-v-e7c8c134]{padding:0} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 51e18eb..8acf183 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ -
์ค๋์ ํ๊ฐํ๋ค์
\r\n์ผ์ ์ ์ถ๊ฐํด๋ด์!
\r\n{{ todo.link ? todo.link : \"No Link\" }}
\r\n์ค๋์ ํ๊ฐํ๋ค์
\r\n์ผ์ ์ ์ถ๊ฐํด๋ด์!
\r\nf?Z(t,i,s,!0,!1,p):j(e,n,r,i,s,c,u,a,p)},G=(t,e,n,r,i,s,c,u,a)=>{let l=0;const f=e.length;let p=t.length-1,d=f-1;while(l<=p&&l<=d){const r=t[l],o=e[l]=a?rn(e[l]):nn(e[l]);if(!Be(r,o))break;g(r,o,n,null,i,s,c,u,a),l++}while(l<=p&&l<=d){const r=t[p],o=e[d]=a?rn(e[d]):nn(e[d]);if(!Be(r,o))break;g(r,o,n,null,i,s,c,u,a),p--,d--}if(l>p){if(l<=d){const t=d+1,o=t f?Z(t,i,s,!0,!1,p):j(e,n,r,i,s,c,u,a,p)},G=(t,e,n,r,i,s,c,u,a)=>{let l=0;const f=e.length;let p=t.length-1,d=f-1;while(l<=p&&l<=d){const r=t[l],o=e[l]=a?rn(e[l]):nn(e[l]);if(!Be(r,o))break;g(r,o,n,null,i,s,c,u,a),l++}while(l<=p&&l<=d){const r=t[p],o=e[d]=a?rn(e[d]):nn(e[d]);if(!Be(r,o))break;g(r,o,n,null,i,s,c,u,a),p--,d--}if(l>p){if(l<=d){const t=d+1,o=t {{ todo.link ? todo.link : "No Link" }}
@@ -72,13 +80,24 @@ dayjs.locale("ko");
export default {
name: "TodoList",
+ data() {
+ return {
+ done: [],
+ };
+ },
methods: {
setSelectedTodo(todo) {
this.$store.commit("SET_SELECTED_TODO", todo);
},
+ ToggleDone(todo) {
+ todo.done = !todo.done;
+ this.$store.dispatch("editTodo", todo);
+ this.$store.dispatch("setTodos", this.$store.getters.getTodos);
+ },
ToggleNoti(todo) {
todo.noti = !todo.noti;
- this.$store.commit("EDIT_TODO", todo);
+ this.$store.dispatch("editTodo", todo);
+ this.$store.dispatch("setTodos", this.$store.getters.getTodos);
},
},
computed: {
@@ -96,12 +115,22 @@ ul {
list-style: none;
overflow: scroll;
}
+input[type="checkbox"] {
+ accent-color: var(--green-blue);
+}
+input[type="checkbox"] {
+ cursor: pointer;
+}
time {
font-size: 1.25rem;
font-weight: 600;
line-height: 1.2;
color: var(--green-blue);
}
+.done {
+ text-decoration: line-through;
+ color: #b9b9b9;
+}
.second-line {
display: flex;
justify-content: space-between;
diff --git a/src/store/modules/todos.js b/src/store/modules/todos.js
index 1c9fbeb..140595d 100644
--- a/src/store/modules/todos.js
+++ b/src/store/modules/todos.js
@@ -1,3 +1,47 @@
+function CreateAlarm(todo) {
+ if (
+ todo.date.getTime() > Date.now() &&
+ todo.noti === true &&
+ todo.done === false &&
+ todo.time !== null
+ ) {
+ console.log("์๋ ์์ฑ ์กฐ๊ฑด์ ๋ง์.");
+ try {
+ //eslint-disable-next-line
+ chrome.alarms.create(todo.id.toString(), {
+ when: todo.date.getTime(),
+ });
+ } catch {
+ console.log("chrome.alarms.create๋ฅผ ์ฌ์ฉํ ์ ์์.");
+ }
+ }
+}
+function DeleteAlarm(id) {
+ try {
+ const clearCallback = (wasCleared) => {
+ console.log("was cleared : ", wasCleared);
+ };
+ //eslint-disable-next-line
+ chrome.alarms.clear(id.toString(), clearCallback);
+ } catch {
+ console.log("Chrome.alarm ์ญ์ ๋์ง ์์");
+ }
+}
+function SetChromeStorageData(todos) {
+ todos.map((todo) => {
+ todo.date = todo.date.getTime();
+ return todo;
+ });
+ try {
+ //eslint-disable-next-line
+ chrome.storage.local
+ .set({ todos: todos })
+ .then(console.log("value is set to", todos));
+ } catch {
+ console.log("chrome.storage.local์ ์ ์ฅ ๋ถ๊ฐ");
+ }
+}
+
export const todos = {
state: () => ({
todos: [],
@@ -31,27 +75,42 @@ export const todos = {
},
getTodosOfDate(state, getters, rootState) {
const selectedDate = rootState.dates.selectedDate;
- return state.todos
- .filter(
- (todo) =>
- todo.date.getFullYear() === selectedDate.getFullYear() &&
- todo.date.getMonth() === selectedDate.getMonth() &&
- todo.date.getDate() === selectedDate.getDate()
- )
- .sort(function (a, b) {
- return a.date - b.date;
- });
+ const convertedTodos = state.todos.map((todo) => {
+ todo.date = new Date(todo.date);
+ return todo;
+ });
+ const filteredTodos = convertedTodos.filter(
+ (todo) =>
+ todo.date.getFullYear() === selectedDate.getFullYear() &&
+ todo.date.getMonth() === selectedDate.getMonth() &&
+ todo.date.getDate() === selectedDate.getDate()
+ );
+ const sortedTodos = filteredTodos.sort(function (a, b) {
+ return a.date - b.date;
+ });
+ return sortedTodos;
},
getSelectedTodo(state) {
return state.selectedTodo;
},
},
actions: {
- setTodos({ commit }, value) {
- commit("SET_TODOS", value);
+ setTodos({ commit }, todos) {
+ commit("SET_TODOS", todos);
+ SetChromeStorageData(todos);
},
- addTodo({ commit }, value) {
- commit("ADD_TODO", value);
+ addTodo({ commit }, todo) {
+ commit("ADD_TODO", todo);
+ CreateAlarm(todo);
+ },
+ deleteTodo({ commit }, id) {
+ commit("DELETE_TODO", id);
+ DeleteAlarm(id);
+ },
+ editTodo({ commit }, newTodo) {
+ commit("EDIT_TODO", newTodo);
+ DeleteAlarm(newTodo.id);
+ CreateAlarm(newTodo);
},
},
};
diff --git a/src/views/ListPage.vue b/src/views/ListPage.vue
index 3e9acfd..96a73b0 100644
--- a/src/views/ListPage.vue
+++ b/src/views/ListPage.vue
@@ -1,26 +1,29 @@