Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge pull request #567 from twin-te/develop" #573

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
60 changes: 0 additions & 60 deletions docs/architecture.md

This file was deleted.

7 changes: 2 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/icon.png" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta
name="description"
content="筑波大学生専用の時間割アプリTwin:te(ついんて)です"
Expand All @@ -24,6 +21,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/ui/main.ts"></script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@gtm-support/vue-gtm": "^1.3.0",
"@sentry/browser": "^6.2.5",
"@sentry/tracing": "^6.2.5",
"@types/lodash": "^4.14.184",
"@types/qs": "^6.9.6",
"@unocss/reset": "^0.31.2",
"@vueuse/core": "^4.6.2",
Expand All @@ -31,7 +30,6 @@
"axios": "^0.21.1",
"dayjs": "^1.10.4",
"firebase": "^8.3.2",
"lodash": "^4.17.21",
"qs": "^6.10.1",
"vue": "^3.0.9",
"vue-router": "4",
Expand Down
61 changes: 61 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<div v-if="hasError" class="error">
<Error :errorMessage="errorMessage"></Error>
</div>
<Suspense v-else>
<template #default>
<Layout>
<router-view v-if="!hasError" />
</Layout>
</template>
<template #fallback>
<div class="loading">now loading...</div>
</template>
</Suspense>
</template>

<script lang="ts">
import { useDark } from "@vueuse/core";
import { defineComponent, onErrorCaptured, onMounted, ref } from "vue";
import Error from "~/components/errro.vue";
import Layout from "~/templates/Layout.vue";
import { isErrorObj } from "~/usecases/error";

export default defineComponent({
name: "App",
components: { Error, Layout },
setup: () => {
useDark({
selector: "body",
});

// unregister service worker (v2)
onMounted(() => {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.unregister();
}
});
});

const hasError = ref(false);
const errorMessage = ref("");
onErrorCaptured((error) => {
hasError.value = true;
if (isErrorObj(error)) {
errorMessage.value = error.message ?? "";
}
});
return { hasError, errorMessage };
},
});
</script>

<style scoped lang="scss">
@import "~/styles";

.loading {
@include center-asolute;
opacity: 0.5;
}
</style>
48 changes: 10 additions & 38 deletions src/adapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
import { Ports } from "~/application/ports";
import { CalendarRepositoryInMemory } from "~/repositories/development/CalendarRepositoryInMemory";
import { CourseRepositoryInMemory } from "~/repositories/development/CourseRepositoryInMemory";
import { FeedbackRepositoryInMemory } from "~/repositories/development/FeedbackRepositoryInMemory";
import { NewsRepositoryInMemory } from "~/repositories/development/NewsRepositoryInMemory";
import { UserRepositoryInMemory } from "~/repositories/development/UserRepositoryInMemory";
import { CalendarRepository } from "~/repositories/production/CalendarRepository";
import { CourseRepository } from "~/repositories/production/CourseRepository";
import { FeedbackRepository } from "~/repositories/production/FeedbackRepository";
import { NewsRepository } from "~/repositories/production/NewsRepository";
import { UserRepository } from "~/repositories/production/UserRepository";

const dev = false;
let ports: Ports | undefined = undefined;

export const usePorts = (): Ports => {
if (ports) return ports;

if (dev) {
ports = {
calendarRepository: new CalendarRepositoryInMemory(),
courseRepository: new CourseRepositoryInMemory(),
feedbackRepository: new FeedbackRepositoryInMemory(),
newsRepository: new NewsRepositoryInMemory(),
userRepository: new UserRepositoryInMemory(),
};
} else {
ports = {
calendarRepository: new CalendarRepository(),
courseRepository: new CourseRepository(),
feedbackRepository: new FeedbackRepository(),
newsRepository: new NewsRepository(),
userRepository: new UserRepository(),
};
}

return ports;
};
import { ConfigType, Dayjs } from "dayjs";
import { Store } from "vuex";
import { ApiInstance } from "~/api/$api";
import { GlobalState } from "~/store";

export interface Ports {
api: ApiInstance;
store: Store<GlobalState>;
dayjs: (date?: ConfigType) => Dayjs;
}
Loading