From c2dc7906e47a05cecc6350fd6a3d6f6f955a3423 Mon Sep 17 00:00:00 2001 From: HampusM Date: Tue, 6 Jul 2021 14:55:58 +0200 Subject: Frontend uses shared types --- packages/client/package.json | 1 + packages/client/src/components/CommitPatch.vue | 20 +------------------- packages/client/src/components/HomeHeader.vue | 9 +++++---- packages/client/src/views/Home.vue | 20 ++++++++------------ packages/client/src/views/Repository.vue | 5 +++-- packages/client/src/views/RepositoryAbout.vue | 7 ++++--- packages/client/src/views/RepositoryCommit.vue | 20 +++++++++++++------- packages/client/src/views/RepositoryLog.vue | 18 +++--------------- packages/client/src/views/RepositoryTree.vue | 16 +--------------- packages/shared_types/src/commit.d.ts | 2 +- 10 files changed, 40 insertions(+), 78 deletions(-) diff --git a/packages/client/package.json b/packages/client/package.json index deaacdf..96529ba 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -21,6 +21,7 @@ }, "devDependencies": { "@types/marked": "^2.0.3", + "shared_types": "workspace:shared_types", "@typescript-eslint/eslint-plugin": "^4.28.1", "@typescript-eslint/parser": "^4.28.1", "@vue/cli-plugin-babel": "~4.5.0", diff --git a/packages/client/src/components/CommitPatch.vue b/packages/client/src/components/CommitPatch.vue index a51a6cb..dca886f 100644 --- a/packages/client/src/components/CommitPatch.vue +++ b/packages/client/src/components/CommitPatch.vue @@ -2,25 +2,7 @@ import { defineComponent, h, PropType, VNode } from "vue"; import hljs from "highlight.js"; import hljs_languages from "../util/hljs-languages"; - -type Hunk = { - new_start: number, - new_lines_cnt: number, - new_lines: number[], - old_start: number, - old_lines_cnt: number, - deleted_lines: number[], - hunk: string -} - -type Patch = { - additions: number, - deletions: number, - from: string, - to: string, - too_large: boolean, - hunks: Hunk[] -} +import { Patch } from "shared_types"; export default defineComponent({ name: "CommitPatch", diff --git a/packages/client/src/components/HomeHeader.vue b/packages/client/src/components/HomeHeader.vue index 74e90f9..64e70e7 100644 --- a/packages/client/src/components/HomeHeader.vue +++ b/packages/client/src/components/HomeHeader.vue @@ -9,6 +9,7 @@