Skip to content

Commit

Permalink
Merge branch 'develop' into fix/fix-finished-topic-timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
yuta-ike committed Jan 5, 2022
2 parents 5d45c46 + 909e9cc commit ba109c2
Show file tree
Hide file tree
Showing 56 changed files with 1,236 additions and 846 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
--deployment-config-name CodeDeployDefault.OneAtATime \
--deployment-group-name ${{ env.PROJECT }}-deploy-group \
--description "Deployment for ${{ env.PROJECT }}" \
--github-location repository=KoukiNAGATA/sushi-chat,commitId="${{ github.sha }}" \
--file-exists-behavior RETAIN \
--github-location repository=$GITHUB_REPOSITORY,commitId="${{ github.sha }}" \
--file-exists-behavior OVERWRITE \
env:
PROJECT: sushi-chat
26 changes: 26 additions & 0 deletions .github/workflows/front-preview-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Frontend preview deploy
on:
pull_request:
paths:
- "app/front/**"
- "yarn.lock"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Deploy to vercel
id: deploy-to-vercel
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}
- name: Comment to PR
uses: thollander/actions-comment-pull-request@v1
with:
message: "Success to deploy preview URL!\n\n${{ steps.deploy-to-vercel.outputs.preview-url }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/front-production-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Frontend production deploy
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Deploy to vercel
id: deploy-to-vercel
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}
vercel-args: "--prod"
8 changes: 0 additions & 8 deletions .idea/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/dataSources.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/jsLinters/eslint.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/prettier.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/sqldialects.xml

This file was deleted.

14 changes: 0 additions & 14 deletions .idea/sushi-chat.iml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/watcherTasks.xml

This file was deleted.

80 changes: 62 additions & 18 deletions app/front/apiClient/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { NuxtAxiosInstance } from "@nuxtjs/axios"
import { RestApi, PathsWithMethod } from "sushi-chat-shared"
import { RestApi, PathsWithMethod, EmptyRecord } from "sushi-chat-shared"
import getIdToken from "~/utils/getIdToken"

type PathObject<
Method extends "get" | "post" | "put",
Expand All @@ -9,6 +10,13 @@ type PathObject<
params: RestApi<Method, Path>["params"]
}

type PathOrPathObj<
Method extends "get" | "post" | "put",
Path extends PathsWithMethod<Method>,
> = Path extends `${string}:${string}`
? PathObject<Method, Path>
: Path | PathObject<Method, Path>

/**
* PathObjectからパスを組み立てる関数
* @param path PathObject
Expand All @@ -32,7 +40,6 @@ const pathBuilder = (path: {
* async asyncData({ app }) {
* const sampleResponse = await app.$apiClient.get(
* { pathname: "/room/:id/history", params: { id: "roomId" } },
* {},
* )
* if (sampleResponse.result === "success") {
* const rooms = sampleResponse.data
Expand All @@ -54,7 +61,8 @@ export default class Repository {
* idTokenを設定する
* @param idToken idToken
*/
public setToken(idToken: string | null) {
public async setToken() {
const idToken = await getIdToken()
if (idToken != null) {
this.nuxtAxios.setToken(`Bearer ${idToken}`)
} else {
Expand All @@ -65,18 +73,18 @@ export default class Repository {
/**
* getリクエストを行う
* @param path エンドポイントを表すPathObjectまたはパス文字列(パスパラメータ(`:xyz`)を含まない場合は直接文字列を指定可能)
* @param data 送信するデータ
* @param query クエリパラメータ
* @returns レスポンス
*/
public async get<Path extends PathsWithMethod<"get">>(
path: Path extends `${string}:${string}`
? PathObject<"get", Path>
: Path | PathObject<"get", Path>,
data: RestApi<"get", Path>["request"],
...[path, query]: RestApi<"get", Path>["query"] extends EmptyRecord
? [path: PathOrPathObj<"get", Path>]
: [path: PathOrPathObj<"get", Path>, query: RestApi<"get", Path>["query"]]
) {
await this.setToken()
return await this.nuxtAxios.$get<RestApi<"get", Path>["response"]>(
typeof path === "string" ? path : pathBuilder(path),
{ data },
{ params: query },
)
}

Expand All @@ -87,14 +95,32 @@ export default class Repository {
* @returns レスポンス
*/
public async post<Path extends PathsWithMethod<"post">>(
path: Path extends `${string}:${string}`
? PathObject<"post", Path>
: Path | PathObject<"post", Path>,
data: RestApi<"post", Path>["request"],
...[path, body, query]: RestApi<"post", Path>["request"] extends EmptyRecord
? RestApi<"post", Path>["query"] extends EmptyRecord
? [path: PathOrPathObj<"post", Path>]
: [
path: PathOrPathObj<"post", Path>,
body: RestApi<"post", Path>["request"],
query: RestApi<"post", Path>["query"],
]
: RestApi<"post", Path>["query"] extends EmptyRecord
? [
path: PathOrPathObj<"post", Path>,
body: RestApi<"post", Path>["request"],
]
: [
path: PathOrPathObj<"post", Path>,
body: RestApi<"post", Path>["request"],
query: RestApi<"post", Path>["query"],
]
) {
await this.setToken()
return await this.nuxtAxios.$post<RestApi<"post", Path>["response"]>(
typeof path === "string" ? path : pathBuilder(path),
data,
body,
{
params: query,
},
)
}

Expand All @@ -105,14 +131,32 @@ export default class Repository {
* @returns レスポンス
*/
public async put<Path extends PathsWithMethod<"put">>(
path: Path extends `${string}:${string}`
? PathObject<"put", Path>
: Path | PathObject<"put", Path>,
data: RestApi<"put", Path>["request"],
...[path, data, query]: RestApi<"put", Path>["request"] extends EmptyRecord
? RestApi<"put", Path>["query"] extends EmptyRecord
? [path: PathOrPathObj<"put", Path>]
: [
path: PathOrPathObj<"put", Path>,
body: RestApi<"put", Path>["request"],
query: RestApi<"put", Path>["query"],
]
: RestApi<"put", Path>["query"] extends EmptyRecord
? [
path: PathOrPathObj<"put", Path>,
body: RestApi<"put", Path>["request"],
]
: [
path: PathOrPathObj<"put", Path>,
body: RestApi<"put", Path>["request"],
query: RestApi<"put", Path>["query"],
]
) {
await this.setToken()
return await this.nuxtAxios.$put<RestApi<"put", Path>["response"]>(
typeof path === "string" ? path : pathBuilder(path),
data,
{
params: query,
},
)
}
}
16 changes: 8 additions & 8 deletions app/front/assets/scss/admin.scss
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
/*管理画面*/
.drawer-menu-wrapper {
position: absolute;
position: fixed;
z-index: $z-modal;
right: 0;
width: 100%;
height: 100%;
background-color: $bg;
word-break: break-all;
display: none;
@media screen and (min-width: $large+px) {
@media screen and (min-width: $large) {
display: block;
}

.drawer-menu {
padding: 30px;
padding: 16px 30px;
display: flex;
flex-direction: column;
height: 100%;
Expand Down Expand Up @@ -161,7 +160,7 @@
justify-content: center;
align-items: center;
& .text-mini {
font-size: 60%;
font-size: 12px;
}
}
}
Expand Down Expand Up @@ -192,6 +191,10 @@
&.pause {
margin-right: 0.5rem;
}

&.reopen {
padding: 10px;
}
}
}
}
Expand Down Expand Up @@ -222,9 +225,6 @@
}

@media screen and (min-width: 880px) {
.drawer-menu-wrapper {
width: calc(80% - 440px - 2em);
}
.room-info {
padding: 0px;
}
Expand Down
4 changes: 4 additions & 0 deletions app/front/assets/scss/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ button {
&:focus-visible {
outline: auto;
}

&:disabled {
cursor: default;
}
}

label {
Expand Down
Loading

0 comments on commit ba109c2

Please sign in to comment.