Skip to content

Commit

Permalink
cssいろいろ
Browse files Browse the repository at this point in the history
  • Loading branch information
shota973 committed Jun 16, 2024
2 parents d58320e + fed1310 commit 45ead25
Show file tree
Hide file tree
Showing 11 changed files with 357 additions and 57 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ module.exports = {
},
],
'no-case-declarations': 'off',
'@typescript-eslint/ban-types': [
'error',
{
types: {
'{}': false,
Object: false,
Function: false,
},
extendDefaults: true,
},
],
},
parser: 'vue-eslint-parser',
parserOptions: {
Expand Down
8 changes: 7 additions & 1 deletion src/icons/ReportIcon.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<script setup lang="ts">
withDefaults(defineProps<{ color: string }>(), {
color: '#FF0000',
})
</script>

<template>
<svg
width="20"
Expand All @@ -20,7 +26,7 @@
<g mask="url(#mask0_37_82)">
<path
d="M10 14.1667C10.2361 14.1667 10.434 14.0868 10.5938 13.9271C10.7535 13.7674 10.8333 13.5694 10.8333 13.3333C10.8333 13.0972 10.7535 12.8993 10.5938 12.7396C10.434 12.5799 10.2361 12.5 10 12.5C9.76389 12.5 9.56597 12.5799 9.40625 12.7396C9.24653 12.8993 9.16667 13.0972 9.16667 13.3333C9.16667 13.5694 9.24653 13.7674 9.40625 13.9271C9.56597 14.0868 9.76389 14.1667 10 14.1667ZM9.16667 10.8333H10.8333V5.83333H9.16667V10.8333ZM6.875 17.5L2.5 13.125V6.875L6.875 2.5H13.125L17.5 6.875V13.125L13.125 17.5H6.875ZM7.58333 15.8333H12.4167L15.8333 12.4167V7.58333L12.4167 4.16667H7.58333L4.16667 7.58333V12.4167L7.58333 15.8333Z"
fill="#FF0000"
:fill="color"
/>
</g>
</svg>
Expand Down
8 changes: 7 additions & 1 deletion src/icons/ThumbUpIcon.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<script setup lang="ts">
withDefaults(defineProps<{ color: string }>(), {
color: '#24A005',
})
</script>

<template>
<svg
width="20"
Expand All @@ -20,7 +26,7 @@
<g mask="url(#mask0_37_77)">
<path
d="M15.0001 17.5H5.83341V6.66666L11.6667 0.833328L12.7084 1.87499C12.8056 1.97222 12.8855 2.10416 12.948 2.27083C13.0105 2.43749 13.0417 2.59722 13.0417 2.74999V3.04166L12.1251 6.66666H17.5001C17.9445 6.66666 18.3334 6.83333 18.6667 7.16666C19.0001 7.49999 19.1667 7.88888 19.1667 8.33333V9.99999C19.1667 10.0972 19.1529 10.2014 19.1251 10.3125C19.0973 10.4236 19.0695 10.5278 19.0417 10.625L16.5417 16.5C16.4167 16.7778 16.2084 17.0139 15.9167 17.2083C15.6251 17.4028 15.3195 17.5 15.0001 17.5ZM7.50008 15.8333H15.0001L17.5001 9.99999V8.33333H10.0001L11.1251 3.74999L7.50008 7.37499V15.8333ZM5.83341 6.66666V8.33333H3.33341V15.8333H5.83341V17.5H1.66675V6.66666H5.83341Z"
fill="#24A005"
:fill="color"
/>
</g>
</svg>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const api = new Apis(
new Configuration({
basePath:
process.env.NODE_ENV === 'production'
? 'https://trap.show/h24s_19_server'
? 'https://h24s-19.trap.show/server'
: 'http://localhost:3000',
}),
)
Expand Down
10 changes: 8 additions & 2 deletions src/pages/CreateRoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ const submit = async () => {
try {
const resp = await api.apiRoomPost(roomInfo)
const roomId = resp.data.roomId
let query = undefined
if (!isPublic.value) {
query = { password: roomPassword.value, isPrivate: 1 }
}
router.push({
path: `/rooms/${roomId}`,
query: { password: roomPassword.value },
path: `/rooms/${roomId}/enter`,
query,
})
} catch (e) {
console.error(e)
Expand Down
124 changes: 124 additions & 0 deletions src/pages/EnterRoom.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import api, { EnterRoom } from '@/lib/apis'
import router from '@/router'
import { useStoreUser } from '@/stores/user'
const store = useStoreUser()
// 部屋に入る前のページ
// 必須: 名前
// private -> 合言葉の入力欄
// 名前を適切に設定 && 合言葉が正しい -> IndividualRoom へ
// 名前に被り || 合言葉が不正 -> 失敗を表示して再入力へ
const thisRoomId = ref('')
const userNickName = ref('')
const roomPassword = ref('')
const submitError = ref(false)
const userSettingError = ref(false)
const submit = async () => {
const enterInfo: EnterRoom = {
userName: userNickName.value,
password: roomPassword.value,
}
try {
// enterRoom を送る
const resp = await api.apiRoomRoomIdEnterPost(thisRoomId.value, enterInfo)
// ここで resp から userId と userName を持たせて IndividualRoom へ
submitError.value = false
// stores/user に userId と userName を記録して、 /rooms/:id に移動させる
const userId = resp.data.userId
store.setUser(resp.data.userName, userId)
router.push({ path: `/rooms/${thisRoomId.value}` })
} catch (e) {
// 通信エラー or userNameエラー or password エラー
console.error(e)
submitError.value = true
}
}
const isPrivate = computed(() => 'isPrivate' in router.currentRoute.value.query)
onMounted(() => {
const roomId = router.currentRoute.value.params.id
if (typeof roomId == 'string') {
thisRoomId.value = roomId
} else {
console.error('Invalid RoomId type')
}
const queryPassword = router.currentRoute.value.query['password']
if (typeof queryPassword == 'string') {
roomPassword.value = queryPassword
}
})
</script>
<template>
<div class="enterRoomContents">
<h2>部屋に入る</h2>
<p>部屋ID: {{ thisRoomId }}</p>
<p>この部屋で使うニックネームを設定してください。</p>
<table class="widthMax">
<label class="widthMax">
<tr class="widthMax">
<th>ニックネーム</th>
<td class="Td">
<input v-model="userNickName" class="enterRoomInputText" />
</td>
</tr>
</label>
<label v-if="isPrivate" class="widthMax">
<tr class="widthMax">
<th>合言葉</th>
<td class="Td">
<input v-model="roomPassword" class="enterRoomInputText" />
</td>
</tr>
</label>
</table>
<div style="text-align: right">
<button class="enterRoomButton" @click="submit()">作成</button>
</div>
<div v-if="userSettingError">
<p>ニックネームが使用不可能。もしくは間違った合言葉です。</p>
</div>
<div v-if="submitError">
<p>エラーが発生しました。操作をやり直してください。</p>
</div>
</div>
</template>
<style scoped>
.read-the-docs {
color: #888;
}
.err {
color: red;
}
.Td {
width: calc(100% - 70px);
display: inline-block;
}
.widthMax {
width: 100%;
display: inline-block;
}
.enterRoomContents {
margin: 20px;
}
.enterRoomInputCheckBox {
accent-color: #78996f;
}
.enterRoomInputLabel {
margin-right: 90px;
}
.enterRoomInputText {
width: 100%;
}
.enterRoomButton {
font-weight: bold;
width: 100px;
height: 50px;
margin: 10px;
margin-right: 30px;
}
</style>
Loading

0 comments on commit 45ead25

Please sign in to comment.