Skip to content

Commit 5bc3fc4

Browse files
authored
Merge branch 'develop' into feature/1071
2 parents c07810e + 632dc30 commit 5bc3fc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1454
-144
lines changed

.github/workflows/tbls.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: tbls-gen
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- closed
10+
11+
jobs:
12+
gen:
13+
name: tbls-gen
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 10
19+
services:
20+
mysql:
21+
image: mysql:8.0
22+
ports:
23+
- 3306:3306
24+
env:
25+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
26+
MYSQL_DATABASE: db
27+
options: >-
28+
--health-cmd="mysqladmin ping"
29+
--health-interval=10s
30+
--health-timeout=5s
31+
--health-retries=3
32+
steps:
33+
- name: checkout
34+
uses: actions/[email protected]
35+
- name: Set up Go
36+
uses: actions/[email protected]
37+
with:
38+
go-version-file: './server/go.mod'
39+
cache: false
40+
check-latest: true
41+
id: go
42+
- name: Ensure go.mod is tidied
43+
working-directory: server
44+
run: go mod tidy
45+
- name: install golang-migrate
46+
run: go install -tags 'mysql' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
47+
- name: mysql wakeup
48+
run: |
49+
until (echo 'SELECT 1' | mysql -h 127.0.0.1 -P 3306 -uroot --silent &> /dev/null); do echo "waiting for mysql to be connectable" && sleep 2; done
50+
- name: mysql migrate for tbls
51+
working-directory: server
52+
run: |
53+
mysql -h 127.0.0.1 -P 3306 -u root -e "CREATE DATABASE IF NOT EXISTS db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin"
54+
migrate -path db/migrations -database "mysql://root:@tcp(127.0.0.1:3306)/db?parseTime=true" up
55+
- name: install tbls
56+
uses: k1low/setup-tbls@v1
57+
- name: run tbls
58+
run: |
59+
TBLS_DSN=mysql://root:@localhost:3306/db tbls doc --rm-dist --config server/config/.tbls.yml
60+
- name: fix tbls
61+
uses: dev-hato/actions-diff-pr-management@v1
62+
with:
63+
github-token: ${{ secrets.GITHUB_TOKEN }}
64+
branch-name-prefix: fix-tbls
65+

client/src/app/community/event/page.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ const EventPage = () => {
5959
};
6060
}, [invitedEvents]);
6161

62-
const handleEventClose = () => {
63-
};
62+
const handleEventClose = () => {};
6463

6564
return (
6665
<>

client/src/app/community/user-detail/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ const ProfileDetailContent = () => {
3030
return <ProfileDetailCard uuid={uuid || ""} />;
3131
};
3232

33-
export default ProfileDetailPage;
33+
export default ProfileDetailPage;

client/src/app/user/community-detail/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ const ProfileDetailContent = () => {
3030
return <ProfileDetailCard uuid={uuid || ""} />;
3131
};
3232

33-
export default ProfileDetailPage;
33+
export default ProfileDetailPage;

client/src/app/user/home/page.tsx

+25-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import CardTag from "@/components/tags/card-tag";
44
import { getTags } from "@/components/tags/hooks/get-tags";
55
import { Input } from "@/components/ui/input";
6-
import { ScrollArea } from "@/components/ui/scroll-area";
6+
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
77
import { Community } from "@/features/account/types/community";
88
import { CommunityCard } from "@/features/home/user/components/CommunityCard";
99
import { GetCommunities } from "@/features/home/user/hooks/gets-communities";
@@ -20,6 +20,11 @@ export default function Home() {
2020
const [tags, setTags] = useState<TagType[]>([]);
2121
const [selectedTags, setSelectedTags] = useState<TagType[]>([]);
2222
const isFirstRender = useRef(true);
23+
const [searchQueryTag, setSearchQueryTag] = useState("");
24+
25+
const filteredTags = tags?.filter(tag =>
26+
tag.name.toLowerCase().includes(searchQueryTag.toLowerCase())
27+
);
2328

2429
useEffect(() => {
2530
if (isFirstRender.current) {
@@ -46,7 +51,7 @@ export default function Home() {
4651
const matchesName = community.name.toLowerCase().includes(searchQuery.toLowerCase());
4752
const matchesTags =
4853
selectedTags.length === 0 ||
49-
selectedTags.every(selectedTag => community.tags?.includes(selectedTag.name));
54+
selectedTags.every(selectedTag => community.tag_name?.includes(selectedTag.name));
5055
return matchesName && matchesTags;
5156
});
5257

@@ -82,13 +87,23 @@ export default function Home() {
8287

8388
<div className="bg-[#FFFFFF1A] p-4 rounded-md mb-6">
8489
<h1 className="text-xl font-bold text-[#FFFFFFD0] mb-2">タグで絞り込む</h1>
85-
<div className="flex flex-wrap gap-2">
86-
{tags?.map(tag => (
87-
<CardTag key={tag.name} variant={tag.color} onClick={() => handleTagClick(tag)}>
88-
{tag.name}
89-
</CardTag>
90-
))}
91-
</div>
90+
<Input
91+
type="text"
92+
placeholder="タグ名で検索..."
93+
value={searchQueryTag}
94+
onChange={(e) => setSearchQueryTag(e.target.value)}
95+
className="mb-4"
96+
/>
97+
<ScrollArea className="w-full whitespace-nowrap rounded-md gap-1">
98+
<div className="flex w-max space-x-4 p-4">
99+
{filteredTags?.map(tag => (
100+
<CardTag key={tag.name} variant={tag.color} onClick={() => handleTagClick(tag)}>
101+
{tag.name}
102+
</CardTag>
103+
))}
104+
</div>
105+
<ScrollBar orientation="horizontal" />
106+
</ScrollArea>
92107
</div>
93108

94109
<ScrollArea className={styles.communityContainer}>
@@ -99,7 +114,7 @@ export default function Home() {
99114
uuid={community.uuid}
100115
communityname={community.name}
101116
icon={community.img}
102-
tags={community.tags}
117+
tags={community.tag_name}
103118
tag_colors={community.tag_colors}
104119
detail={community.self}
105120
university={community.mem1}

client/src/features/account/types/community.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const CommunitySchema = z.object({
1010
mem1: z.string(),
1111
mem2: z.string().optional(),
1212
mem3: z.string().optional(),
13-
tags: z.string().array().optional(),
13+
tag_name: z.string().array().optional(),
1414
tag_colors: z.string().array().optional(),
1515
});
1616

client/src/features/account/types/user.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const UserSchema = z.object({
1010
mem1: z.string().optional(),
1111
mem2: z.string().optional(),
1212
mem3: z.string().optional(),
13-
tags: z.string().array().optional(),
13+
tag_name: z.string().array().optional(),
1414
tag_colors: z.string().array().optional(),
1515
});
1616

client/src/features/chat/components/ChatRooms.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface ChatRoomsProps {
1616

1717
const ChatRooms: React.FC<ChatRoomsProps> = ({ onSelectRoom }) => {
1818
const [rooms, setRooms] = useState<Room[]>([]);
19-
const [accountType, ] = useAtom(accountTypeAtom);
19+
const [accountType] = useAtom(accountTypeAtom);
2020
const [currentUser] = useAtom(userAtom);
2121
const [currentCommunity] = useAtom(communityAtom);
2222

client/src/features/chat/components/ChatWindow.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
22
import React, { useState, useEffect, useRef } from "react";
33
import { Message, Room, SendMessage } from "../types/types";
4-
import "./ChatWindow.scss";
4+
import "./chat-wind.module.scss";
55
import { userAtom } from "@/features/account/stores";
66
import { communityAtom } from "@/features/account/stores";
77
import { accountTypeAtom } from "@/features/account/stores"; // axiosをインポート
@@ -37,7 +37,7 @@ const ChatWindow: React.FC<ChatWindowProps> = ({ room }) => {
3737
return;
3838
}
3939

40-
let account;
40+
let account = "";
4141
if (accountType === "community") {
4242
account = currentCommunity?.uuid || "gg";
4343
} else if (accountType === "user") {
@@ -48,7 +48,7 @@ const ChatWindow: React.FC<ChatWindowProps> = ({ room }) => {
4848
// メッセージ履歴を取得
4949
fetchMessageHistory(room.id);
5050

51-
ws.current = new WebSocket(`ws://localhost:8080/api/ws/chat/` + room.id);
51+
ws.current = new WebSocket(`${process.env.NEXT_PUBLIC_WEBSOCKET_URL}/ws/chat/${room.id}`);
5252

5353
ws.current.onopen = () => {
5454
console.log("WebSocket connection established");
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import CardTag from "@/components/tags/card-tag";
22
import { TagType } from "@/features/tags/types/tag";
3+
import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area";
4+
import { Input } from "@/components/ui/input";
5+
import { useState } from "react";
36
import style from "../styles/search-tags.module.scss";
47

58
type SearchTagsProps = {
@@ -8,16 +11,32 @@ type SearchTagsProps = {
811
};
912

1013
export function SearchTags({ tags, handleTagClick }: SearchTagsProps) {
14+
const [searchQuery, setSearchQuery] = useState("");
15+
16+
const filteredTags = tags?.filter(tag =>
17+
tag.name.toLowerCase().includes(searchQuery.toLowerCase())
18+
);
19+
1120
return (
1221
<div className={style.container}>
1322
<h1 className={style.title}>タグで絞り込む</h1>
14-
<div className={style.tags}>
15-
{tags?.map(tag => (
16-
<CardTag key={tag.name} variant={tag.color} onClick={() => handleTagClick(tag)}>
17-
{tag.name}
18-
</CardTag>
19-
))}
20-
</div>
23+
<Input
24+
type="text"
25+
placeholder="タグ名で検索..."
26+
value={searchQuery}
27+
onChange={(e) => setSearchQuery(e.target.value)}
28+
className="mb-4"
29+
/>
30+
<ScrollArea className="w-full whitespace-nowrap rounded-md border gap-1">
31+
<div className="flex w-max space-x-4 p-4">
32+
{filteredTags?.map(tag => (
33+
<CardTag key={tag.name} variant={tag.color} onClick={() => handleTagClick(tag)}>
34+
{tag.name}
35+
</CardTag>
36+
))}
37+
</div>
38+
<ScrollBar orientation="horizontal" />
39+
</ScrollArea>
2140
</div>
2241
);
23-
}
42+
}

client/src/features/home/community/components/UserList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function UserList({ users, handleCardClick, selectedUser }: UserListProps
2020
uuid={user.uuid}
2121
username={user.name}
2222
icon={user.img}
23-
tags={user.tags}
23+
tags={user.tag_name}
2424
tag_colors={user.tag_colors}
2525
detail={user.self}
2626
university={user.mem1}

client/src/features/home/community/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import { useAtom } from "jotai";
1111
import { useRouter } from "next/navigation";
1212
import { useEffect, useRef, useState } from "react";
1313
import { toast } from "sonner";
14-
import { UserList } from "./components/UserList";
1514
import { MessageForm } from "./components/MessageForm";
1615
import { SearchBar } from "./components/SearchBar";
1716
import { SearchTags } from "./components/SearchTags";
1817
import { SelectedUserBadges } from "./components/SelectedUserBadges";
18+
import { UserList } from "./components/UserList";
1919

2020
export function CommunityHome() {
2121
const [users, setUsers] = useState<User[]>([]);
@@ -46,7 +46,7 @@ export function CommunityHome() {
4646
const matchesName = user.name.toLowerCase().includes(searchQuery.toLowerCase());
4747
const matchesTags =
4848
selectedTags.length === 0 ||
49-
selectedTags.every(selectedTag => user.tags?.includes(selectedTag.name));
49+
selectedTags.every(selectedTag => user.tag_name?.includes(selectedTag.name));
5050
return matchesName && matchesTags;
5151
});
5252

Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
@use "@/styles/theme";
22

3-
43
.container {
5-
background-color: theme.$theme-community-sub;
6-
padding: 1rem;
7-
border-radius: 0.5rem;
8-
margin: 1rem 0;
9-
}
4+
background-color: theme.$theme-community-sub;
5+
padding: 1rem;
6+
border-radius: 0.5rem;
7+
margin: 1rem 0;
8+
}
9+
10+
.title {
11+
font-size: 1.25rem;
12+
font-weight: bold;
13+
color: black;
14+
margin-bottom: 0.5rem;
15+
}
1016

11-
.title {
12-
font-size: 1.25rem;
13-
font-weight: bold;
14-
color: black;
15-
margin-bottom: 0.5rem;
16-
}
17+
.tags {
18+
overflow-x: auto;
19+
white-space: nowrap;
20+
}
1721

18-
.tags {
19-
display: flex;
20-
flex-wrap: wrap;
21-
gap: 0.5rem;
22-
}
22+
.tagsContainer {
23+
display: inline-flex;
24+
gap: 0.5rem;
25+
}

0 commit comments

Comments
 (0)