Skip to content

Commit

Permalink
UI changes, storing search engine prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbikbetal committed Aug 8, 2020
1 parent 4bee12f commit ef0a0f6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/FavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</fab>

<!-- Site thumbs -->
<section id="fav-bar" class="flex overflow-x-auto overflow-y-hidden no-scrollbar">
<section id="fav-bar" class="flex overflow-x-auto overflow-y-hidden no-scrollbar mx-6">
<draggable
v-model="sites"
group="sites"
Expand Down Expand Up @@ -118,7 +118,7 @@ export default {
}
.fav-thumb-container {
@apply flex;
@apply justify-center;
@apply justify-start;
@apply pb-2;
@apply rounded-md;
@apply relative;
Expand Down
17 changes: 11 additions & 6 deletions src/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,29 @@ export default {
{
name: "Yandex",
url: "https://yandex.com/search/?text=",
icon: "https://yastatic.net/iconostasis/_/KKii9ECKxo3QZnchF7ayZhbzOT8.png",
icon:
"https://yastatic.net/iconostasis/_/KKii9ECKxo3QZnchF7ayZhbzOT8.png",
},
],
selected: undefined,
};
},
computed: {
selectedEngine() {
return this.selected || this.searchEngines[0];
return this.$store.state.searchEngine || this.searchEngines[0];
},
},
methods: {
search() {
var win = window.open(this.selectedEngine.url + this.terms, "_blank");
win.focus();
try {
var win = window.open(this.selectedEngine.url + this.terms, "_blank");
win.focus();
} catch (error) {
// show a popup and allow opening new sites
// window.location.href = this.selectedEngine.url + this.terms;
}
},
setEngine(item) {
this.selected = item;
this.$store.commit("setSearchEngine", item);
},
},
};
Expand Down
11 changes: 10 additions & 1 deletion src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ export default new Store({
],
counters: [4, 8],
columns: [0, 1, 2],
theme: "Dark"
theme: "Dark",
searchEngine: {
name: "DuckDuckGo",
url: "https://duckduckgo.com/?q=",
icon: "https://duckduckgo.com/favicon.ico",
}
},
mutations: {
//Overwrite app state
Expand All @@ -53,6 +58,10 @@ export default new Store({
setTheme(state, theme) {
state.theme = theme;
},
// Set search engine
setSearchEngine(state, searchEngine) {
state.searchEngine = searchEngine;
},
// Columns
increaseCols(state) {
if (state.columns.length < 5)
Expand Down

0 comments on commit ef0a0f6

Please sign in to comment.