Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
健杭 徐
intern_project_frontend_backend
Commits
6e279d4c
Commit
6e279d4c
authored
Jun 16, 2025
by
健杭 徐
Browse files
base backend
parent
fdaa4fce
Changes
30
Show whitespace changes
Inline
Side-by-side
myproject/frontend/src/app/globals.css
0 → 100644
View file @
6e279d4c
:root
{
--background
:
#ffffff
;
--foreground
:
#171717
;
}
@media
(
prefers-color-scheme
:
dark
)
{
:root
{
--background
:
#0a0a0a
;
--foreground
:
#ededed
;
}
}
html
,
body
{
max-width
:
100vw
;
overflow-x
:
hidden
;
}
body
{
color
:
var
(
--foreground
);
background
:
var
(
--background
);
font-family
:
Arial
,
Helvetica
,
sans-serif
;
-webkit-font-smoothing
:
antialiased
;
-moz-osx-font-smoothing
:
grayscale
;
}
*
{
box-sizing
:
border-box
;
padding
:
0
;
margin
:
0
;
}
a
{
color
:
inherit
;
text-decoration
:
none
;
}
@media
(
prefers-color-scheme
:
dark
)
{
html
{
color-scheme
:
dark
;
}
}
myproject/frontend/src/app/layout.tsx
0 → 100644
View file @
6e279d4c
import
type
{
Metadata
}
from
"
next
"
;
import
{
Geist
,
Geist_Mono
}
from
"
next/font/google
"
;
import
"
./globals.css
"
;
const
geistSans
=
Geist
({
variable
:
"
--font-geist-sans
"
,
subsets
:
[
"
latin
"
],
});
const
geistMono
=
Geist_Mono
({
variable
:
"
--font-geist-mono
"
,
subsets
:
[
"
latin
"
],
});
export
const
metadata
:
Metadata
=
{
title
:
"
Create Next App
"
,
description
:
"
Generated by create next app
"
,
};
export
default
function
RootLayout
({
children
,
}:
Readonly
<
{
children
:
React
.
ReactNode
;
}
>
)
{
return
(
<
html
lang
=
"en"
>
<
body
className
=
{
`
${
geistSans
.
variable
}
${
geistMono
.
variable
}
`
}
>
{
children
}
</
body
>
</
html
>
);
}
myproject/frontend/src/app/page.module.css
0 → 100644
View file @
6e279d4c
.page
{
--gray-rgb
:
0
,
0
,
0
;
--gray-alpha-200
:
rgba
(
var
(
--gray-rgb
),
0.08
);
--gray-alpha-100
:
rgba
(
var
(
--gray-rgb
),
0.05
);
--button-primary-hover
:
#383838
;
--button-secondary-hover
:
#f2f2f2
;
display
:
grid
;
grid-template-rows
:
20px
1
fr
20px
;
align-items
:
center
;
justify-items
:
center
;
min-height
:
100
svh
;
padding
:
80px
;
gap
:
64px
;
font-family
:
var
(
--font-geist-sans
);
}
@media
(
prefers-color-scheme
:
dark
)
{
.page
{
--gray-rgb
:
255
,
255
,
255
;
--gray-alpha-200
:
rgba
(
var
(
--gray-rgb
),
0.145
);
--gray-alpha-100
:
rgba
(
var
(
--gray-rgb
),
0.06
);
--button-primary-hover
:
#ccc
;
--button-secondary-hover
:
#1a1a1a
;
}
}
.main
{
display
:
flex
;
flex-direction
:
column
;
gap
:
32px
;
grid-row-start
:
2
;
}
.main
ol
{
font-family
:
var
(
--font-geist-mono
);
padding-left
:
0
;
margin
:
0
;
font-size
:
14px
;
line-height
:
24px
;
letter-spacing
:
-0.01em
;
list-style-position
:
inside
;
}
.main
li
:not
(
:last-of-type
)
{
margin-bottom
:
8px
;
}
.main
code
{
font-family
:
inherit
;
background
:
var
(
--gray-alpha-100
);
padding
:
2px
4px
;
border-radius
:
4px
;
font-weight
:
600
;
}
.ctas
{
display
:
flex
;
gap
:
16px
;
}
.ctas
a
{
appearance
:
none
;
border-radius
:
128px
;
height
:
48px
;
padding
:
0
20px
;
border
:
none
;
border
:
1px
solid
transparent
;
transition
:
background
0.2s
,
color
0.2s
,
border-color
0.2s
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-size
:
16px
;
line-height
:
20px
;
font-weight
:
500
;
}
a
.primary
{
background
:
var
(
--foreground
);
color
:
var
(
--background
);
gap
:
8px
;
}
a
.secondary
{
border-color
:
var
(
--gray-alpha-200
);
min-width
:
158px
;
}
.footer
{
grid-row-start
:
3
;
display
:
flex
;
gap
:
24px
;
}
.footer
a
{
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
}
.footer
img
{
flex-shrink
:
0
;
}
/* Enable hover only on non-touch devices */
@media
(
hover
:
hover
)
and
(
pointer
:
fine
)
{
a
.primary
:hover
{
background
:
var
(
--button-primary-hover
);
border-color
:
transparent
;
}
a
.secondary
:hover
{
background
:
var
(
--button-secondary-hover
);
border-color
:
transparent
;
}
.footer
a
:hover
{
text-decoration
:
underline
;
text-underline-offset
:
4px
;
}
}
@media
(
max-width
:
600px
)
{
.page
{
padding
:
32px
;
padding-bottom
:
80px
;
}
.main
{
align-items
:
center
;
}
.main
ol
{
text-align
:
center
;
}
.ctas
{
flex-direction
:
column
;
}
.ctas
a
{
font-size
:
14px
;
height
:
40px
;
padding
:
0
16px
;
}
a
.secondary
{
min-width
:
auto
;
}
.footer
{
flex-wrap
:
wrap
;
align-items
:
center
;
justify-content
:
center
;
}
}
@media
(
prefers-color-scheme
:
dark
)
{
.logo
{
filter
:
invert
();
}
}
myproject/frontend/src/app/page.tsx
0 → 100644
View file @
6e279d4c
import
Image
from
"
next/image
"
;
import
styles
from
"
./page.module.css
"
;
export
default
function
Home
()
{
return
(
<
div
className
=
{
styles
.
page
}
>
<
main
className
=
{
styles
.
main
}
>
<
Image
className
=
{
styles
.
logo
}
src
=
"/next.svg"
alt
=
"Next.js logo"
width
=
{
180
}
height
=
{
38
}
priority
/>
<
ol
>
<
li
>
Get started by editing
<
code
>
src/app/page.tsx
</
code
>
.
</
li
>
<
li
>
Save and see your changes instantly.
</
li
>
</
ol
>
<
div
className
=
{
styles
.
ctas
}
>
<
a
className
=
{
styles
.
primary
}
href
=
"https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
Image
className
=
{
styles
.
logo
}
src
=
"/vercel.svg"
alt
=
"Vercel logomark"
width
=
{
20
}
height
=
{
20
}
/>
Deploy now
</
a
>
<
a
href
=
"https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target
=
"_blank"
rel
=
"noopener noreferrer"
className
=
{
styles
.
secondary
}
>
Read our docs
</
a
>
</
div
>
</
main
>
<
footer
className
=
{
styles
.
footer
}
>
<
a
href
=
"https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
Image
aria-hidden
src
=
"/file.svg"
alt
=
"File icon"
width
=
{
16
}
height
=
{
16
}
/>
Learn
</
a
>
<
a
href
=
"https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
Image
aria-hidden
src
=
"/window.svg"
alt
=
"Window icon"
width
=
{
16
}
height
=
{
16
}
/>
Examples
</
a
>
<
a
href
=
"https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target
=
"_blank"
rel
=
"noopener noreferrer"
>
<
Image
aria-hidden
src
=
"/globe.svg"
alt
=
"Globe icon"
width
=
{
16
}
height
=
{
16
}
/>
Go to nextjs.org →
</
a
>
</
footer
>
</
div
>
);
}
myproject/frontend/tsconfig.json
0 → 100644
View file @
6e279d4c
{
"compilerOptions"
:
{
"target"
:
"ES2017"
,
"lib"
:
[
"dom"
,
"dom.iterable"
,
"esnext"
],
"allowJs"
:
true
,
"skipLibCheck"
:
true
,
"strict"
:
true
,
"noEmit"
:
true
,
"esModuleInterop"
:
true
,
"module"
:
"esnext"
,
"moduleResolution"
:
"bundler"
,
"resolveJsonModule"
:
true
,
"isolatedModules"
:
true
,
"jsx"
:
"preserve"
,
"incremental"
:
true
,
"plugins"
:
[
{
"name"
:
"next"
}
],
"paths"
:
{
"@/*"
:
[
"./src/*"
]
}
},
"include"
:
[
"next-env.d.ts"
,
"**/*.ts"
,
"**/*.tsx"
,
".next/types/**/*.ts"
],
"exclude"
:
[
"node_modules"
]
}
myproject/go/go.mod
deleted
100644 → 0
View file @
fdaa4fce
module xlab.zju.edu.cn/git/1158csth/intern_project_frontend_backend
go 1.24.3
myproject/go/main.go
deleted
100644 → 0
View file @
fdaa4fce
myproject/my-app/src/app/globals.css
View file @
6e279d4c
...
@@ -73,3 +73,69 @@ h1, h2, h3, h4, h5, h6,
...
@@ -73,3 +73,69 @@ h1, h2, h3, h4, h5, h6,
--font-size-sm
:
11px
;
--font-size-sm
:
11px
;
}
}
}
}
.context-menu
{
/* From Uiverse.io by andrew-demchenk0 */
.button
{
--main-focus
:
#2d8cf0
;
--font-color
:
#323232
;
--bg-color-sub
:
#dedede
;
--bg-color
:
#eee
;
--main-color
:
#323232
;
position
:
relative
;
width
:
150px
;
height
:
40px
;
cursor
:
pointer
;
display
:
flex
;
align-items
:
center
;
border
:
2px
solid
var
(
--main-color
);
box-shadow
:
4px
4px
var
(
--main-color
);
background-color
:
var
(
--bg-color
);
border-radius
:
10px
;
overflow
:
hidden
;
}
.button
,
.button__icon
,
.button__text
{
transition
:
all
0.3s
;
}
.button
.button__text
{
transform
:
translateX
(
33px
);
color
:
var
(
--font-color
);
font-weight
:
600
;
}
.button
.button__icon
{
position
:
absolute
;
transform
:
translateX
(
109px
);
height
:
100%
;
width
:
39px
;
background-color
:
var
(
--bg-color-sub
);
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
.button
.svg
{
width
:
20px
;
fill
:
var
(
--main-color
);
}
.button
:hover
{
background
:
var
(
--bg-color
);
}
.button
:hover
.button__text
{
color
:
transparent
;
}
.button
:hover
.button__icon
{
width
:
148px
;
transform
:
translateX
(
0
);
}
.button
:active
{
transform
:
translate
(
3px
,
3px
);
box-shadow
:
0px
0px
var
(
--main-color
);
}
}
\ No newline at end of file
myproject/my-app/src/app/page.tsx
View file @
6e279d4c
'
use client
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
import
ChatRoom
from
"
./pages/ChatRoom/ChatRoom
"
;
import
ChatRoom
from
"
./pages/ChatRoom/ChatRoom
"
;
import
"
./globals.css
"
;
import
"
./globals.css
"
;
...
...
myproject/my-app/src/app/pages/ChatRoom/ChatRoom.tsx
View file @
6e279d4c
'
use client
'
;
'
use client
'
;
import
"
./ChatRoom.css
"
;
import
"
./ChatRoom.css
"
;
import
React
,
{
Component
}
from
"
react
"
;
import
React
,
{
useState
}
from
"
react
"
;
// profile
// profile
const
Profile
=
[
'
https://pic4.zhimg.com/v2-c5a0d0d57c1a85c6db56e918707f54a3_r.jpg
'
,
const
Profile
=
[
'
https://pic4.zhimg.com/v2-c5a0d0d57c1a85c6db56e918707f54a3_r.jpg
'
,
...
@@ -46,6 +46,35 @@ function RoomEntry (props: RoomEntryProps) {
...
@@ -46,6 +46,35 @@ function RoomEntry (props: RoomEntryProps) {
// Button From Uiverse.io by njesenberger
// Button From Uiverse.io by njesenberger
}
}
function
InputRoomNameArea
()
{
const
[
roomId
,
setRoomId
]
=
useState
(
0
);
return
(
<
div
className
=
"open"
>
<
div
className
=
"roomName-input"
>
<
h3
>
Please Enter the New Room Name
</
h3
>
<
input
type
=
"text"
className
=
"RoomNameInput"
placeholder
=
"Search or start new chat"
onKeyUpCapture
=
{
(
e
:
React
.
KeyboardEvent
<
HTMLInputElement
>
)
=>
{
if
(
e
.
key
===
'
Enter
'
)
{
addNewRoom
();
}
else
if
(
e
.
key
===
'
Escape
'
)
{
closeOpenDiv
();
}
}
}
/>
<
div
className
=
"button-container"
>
<
button
className
=
"create-button"
onClick
=
{
addNewRoom
}
>
Submit
</
button
>
<
button
className
=
"cancel-button"
onClick
=
{
closeOpenDiv
}
>
Cancel
</
button
>
</
div
>
</
div
>
</
div
>
);
}
function
addNewRoom
()
{
function
addNewRoom
()
{
const
RoomNameInput
=
(
document
.
getElementsByClassName
(
"
RoomNameInput
"
)[
0
]
as
HTMLInputElement
).
value
;
const
RoomNameInput
=
(
document
.
getElementsByClassName
(
"
RoomNameInput
"
)[
0
]
as
HTMLInputElement
).
value
;
if
(
RoomNameInput
===
""
)
{
if
(
RoomNameInput
===
""
)
{
...
@@ -97,6 +126,9 @@ interface MessageProps {
...
@@ -97,6 +126,9 @@ interface MessageProps {
}
>
;
}
>
;
}
}
function
MessageItem
(
props
:
MessageProps
)
{
function
MessageItem
(
props
:
MessageProps
)
{
if
(
props
.
roomId
===
0
)
{
return
<
div
className
=
"message-item"
>
Please select a room to chat.
</
div
>;
}
return
(
return
(
<
div
className
=
"message-item"
>
<
div
className
=
"message-item"
>
<
div
className
=
"message-header"
>
<
div
className
=
"message-header"
>
...
@@ -189,34 +221,13 @@ export default function ChatRoom() {
...
@@ -189,34 +221,13 @@ export default function ChatRoom() {
<
div
className
=
"chat-room"
>
<
div
className
=
"chat-room"
>
<
RoomEntry
roomId
=
{
1
}
roomName
=
"General"
lastSender
=
"Alice"
lastContent
=
"Hello!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
lastTime
=
{
Date
.
now
()
}
/>
<
RoomEntry
roomId
=
{
1
}
roomName
=
"General"
lastSender
=
"Alice"
lastContent
=
"Hello!aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
lastTime
=
{
Date
.
now
()
}
/>
<
MessageItem
<
MessageItem
roomId
=
{
1
}
roomId
=
{
0
}
roomName
=
"General"
roomName
=
"General"
messages
=
{
[
messages
=
{
[
{
profile
:
2
,
sender
:
"
Alice
"
,
content
:
"
Hello!
"
,
time
:
Date
.
now
()
-
60000
}
{
profile
:
2
,
sender
:
"
Alice
"
,
content
:
"
Hello!
"
,
time
:
Date
.
now
()
-
60000
}
]
}
]
}
/>
/>
<
div
className
=
"open"
>
<
InputRoomNameArea
/>
<
div
className
=
"roomName-input"
>
<
h3
>
Please Enter the New Room Name
</
h3
>
<
input
type
=
"text"
className
=
"RoomNameInput"
placeholder
=
"Search or start new chat"
onKeyUpCapture
=
{
(
e
:
React
.
KeyboardEvent
<
HTMLInputElement
>
)
=>
{
if
(
e
.
key
===
'
Enter
'
)
{
addNewRoom
();
}
else
if
(
e
.
key
===
'
Escape
'
)
{
closeOpenDiv
();
}
}
}
/>
<
div
className
=
"button-container"
>
<
button
className
=
"create-button"
onClick
=
{
addNewRoom
}
>
Submit
</
button
>
<
button
className
=
"cancel-button"
onClick
=
{
closeOpenDiv
}
>
Cancel
</
button
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
);
);
}
}
\ No newline at end of file
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment