Skip to content

Commit

Permalink
adding import statements and updating dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurier committed Feb 27, 2024
1 parent bc4ce14 commit 909a889
Show file tree
Hide file tree
Showing 8 changed files with 1,796 additions and 1,759 deletions.
3,481 changes: 1,758 additions & 1,723 deletions frontend/package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"deploy": "node scripts/gh-pages-deploy.js"
},
"dependencies": {
"@cznethub/cznet-vue-core": "^0.1.84",
"@cznethub/cznet-vue-core": "^0.1.91",
"@fortawesome/fontawesome-free": "^5.15.4",
"@hrwg/vue-marked": "0.0.2",
"@vue/composition-api": "^1.7.1",
Expand All @@ -21,7 +21,7 @@
"google-maps": "^4.3.3",
"lodash.isequal": "^4.5.0",
"rxjs": "^7.8.0",
"vue": "^2.7.14",
"vue": "^2.7.16",
"vue-browser-detect-plugin": "^0.1.18",
"vue-cookies": "^1.8.2",
"vue-i18n": "^8.28.2",
Expand Down Expand Up @@ -69,4 +69,4 @@
"last 2 versions",
"not dead"
]
}
}
1 change: 1 addition & 0 deletions frontend/src/assets/css/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// }
@import '~@fortawesome/fontawesome-free/css/all.min.css';
@import '~@cznethub/cznet-vue-core/dist/style.css';

html {
font-size: 16px;
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import browserDetect from "vue-browser-detect-plugin";
import VueRouter from "vue-router";
import VueI18n from "vue-i18n";
import VueTimeago from "vue-timeago";
import vueFilterPrettyBytes from "vue-filter-pretty-bytes";

import { router } from "./router/router";
import { orm } from "@/models/orm";
Expand All @@ -31,7 +30,6 @@ import { messages } from "./i18n/messages";

Vue.config.productionTip = false;
Vue.use(Vuex);
Vue.use(vueFilterPrettyBytes);

// Create Vuex Store and register database through Vuex ORM.
const store = new Vuex.Store({
Expand Down
60 changes: 30 additions & 30 deletions frontend/src/models/search-history.model.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
import { Model } from '@vuex-orm/core'
import { Model } from "@vuex-orm/core";
import { IHint } from "../types";

export interface ISearchHistoryState {
}
export interface ISearchHistoryState {}

export interface ISearch {
key: string
date: number
key: string;
date: number;
}

export default class SearchHistory extends Model implements ISearch {
static entity = 'search-history'
static primaryKey = 'key'
public readonly key!: string
public readonly date!: number
static entity = "search-history";
static primaryKey = "key";
public readonly key!: string;
public readonly date!: number;

static fields() {
return {
key: this.attr(''),
date: this.attr(0)
}
key: this.attr(""),
date: this.attr(0),
};
}

static get $state(): ISearchHistoryState {
return this.store().state.entities[this.entity]
return this.store().state.entities[this.entity];
}

static state(): ISearchHistoryState {
return {
}
return {};
}

public static log(key: string) {
SearchHistory.insert({ data: { key, date: Date.now() } })
SearchHistory.insert({ data: { key, date: Date.now() } });
}

public static searchHints(searchString: string): IHint[] {
if (!(searchString?.trim())) {
if (!searchString?.trim()) {
return this.all()
.sort((a, b) => b.date - a.date)
.map(entry => ({ type: 'local', key: entry.key }))
.slice(0, 10) as IHint[]
.map((entry) => ({ type: "local", key: entry.key }))
.slice(0, 10) as IHint[];
}

const str = searchString.trim()
const str = searchString.trim();

return this.all()
.filter((entry: ISearch) => {
const val = entry.key.toLowerCase()
return val.includes(str.toLowerCase()) &&
val.length > str.length
})
.sort((a, b) => b.date - a.date)
.map(entry => ({ type: 'local', key: entry.key })) || []
return (
this.all()
.filter((entry: ISearch) => {
const val = entry.key.toLowerCase();
return val.includes(str.toLowerCase()) && val.length > str.length;
})
.sort((a, b) => b.date - a.date)
.map((entry) => ({ type: "local", key: entry.key })) || []
);
}

public static deleteHint(key: string) {
this.delete(key)
this.delete(key);
}
}
}
1 change: 1 addition & 0 deletions frontend/src/models/search.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Model } from "@vuex-orm/core";
import { ENDPOINTS } from "@/constants";
import { getQueryString } from "@/util";
import { IResult, ISearchParams, ITypeaheadParams } from "../types";

export interface ISearchState {
results: IResult[];
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ISearchParams, ITypeaheadParams } from "./types";

/** Transforms the values in a dictionary into strings, and filters out falsey entries and array entries
* Array values need to be stringified with `stringifyArrayParamValues`
* @returns the resulting object after filter and transformation
Expand Down
2 changes: 1 addition & 1 deletion frontend/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit 909a889

Please sign in to comment.