diff --git a/Dockerfile b/Dockerfile index 085cda7..8fb828c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM node:16.14.0 AS dependencies +FROM node:16.14.2 AS dependencies WORKDIR /usr/src/app COPY ./package*.json ./ RUN npm install -FROM node:16.14.0 AS builder +FROM node:16.14.2 AS builder WORKDIR /usr/src/app COPY ./ ./ COPY --from=dependencies /usr/src/app/node_modules ./node_modules RUN npm run build -FROM node:16.14.0 AS runner +FROM node:16.14.2 AS runner WORKDIR /usr/src/app ENV NODE_ENV=production COPY --from=builder /usr/src/app/next.config.js ./next.config.js diff --git a/README.md b/README.md index d0daf7c..e4d7927 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Thream's website to stay close with your friends and communities. -It uses [Thream/api](https://github.com/Thream/api) v1.0.0. +It uses [Thream/api](https://github.com/Thream/api) [v1.0.0](https://github.com/Thream/api/releases/tag/v1.0.0). ## ⚙️ Getting Started diff --git a/components/Application/Application.tsx b/components/Application/Application.tsx index d870188..964294c 100644 --- a/components/Application/Application.tsx +++ b/components/Application/Application.tsx @@ -184,6 +184,7 @@ export const Application: React.FC = (props) => { title='Settings' > ', () => { - it('should render successfully', () => { - const { baseElement } = render( - - ) - expect(baseElement).toBeTruthy() - }) -}) diff --git a/components/Application/Channels/Channel/Channel.tsx b/components/Application/Channels/Channel/Channel.tsx index 762f238..7750d8a 100644 --- a/components/Application/Channels/Channel/Channel.tsx +++ b/components/Application/Channels/Channel/Channel.tsx @@ -1,8 +1,12 @@ import classNames from 'classnames' import Link from 'next/link' +import { useRouter } from 'next/router' +import { CogIcon } from '@heroicons/react/solid' import { GuildsChannelsPath } from '../../Application' import { Channel as ChannelType } from '../../../../models/Channel' +import { useGuildMember } from '../../../../contexts/GuildMember' +import { IconButton } from '../../../design/IconButton' export interface ChannelProps { path: GuildsChannelsPath @@ -12,20 +16,39 @@ export interface ChannelProps { export const Channel: React.FC = (props) => { const { channel, path, selected = false } = props + const router = useRouter() + + const { member } = useGuildMember() return ( - + # {channel.name} + {member.isOwner && ( + { + await router.push( + `/application/${channel.guildId}/${channel.id}/settings` + ) + }} + className='bg-unherit absolute -right-10 h-full w-8 transition-all group-hover:right-0 group-hover:shadow-lg dark:group-hover:bg-gray-600' + title='Settings' + > + + + )} ) diff --git a/components/Application/ConfirmGuildJoin/ConfirmGuildJoin.tsx b/components/Application/ConfirmGuildJoin/ConfirmGuildJoin.tsx index d1d11c3..20ab7cd 100644 --- a/components/Application/ConfirmGuildJoin/ConfirmGuildJoin.tsx +++ b/components/Application/ConfirmGuildJoin/ConfirmGuildJoin.tsx @@ -38,6 +38,7 @@ export const ConfirmGuildJoin: React.FC = ({ )} > Join Guild Illustration { setInputValues(formData as any) return { type: 'success', - value: 'common:name' + value: 'application:saved-information' } } catch (error) { return { @@ -130,6 +130,7 @@ export const GuildSettings: React.FC = () => {
{ )}
- + ) diff --git a/components/Application/Guilds/Guild/Guild.tsx b/components/Application/Guilds/Guild/Guild.tsx index 7476f0c..23d88d7 100644 --- a/components/Application/Guilds/Guild/Guild.tsx +++ b/components/Application/Guilds/Guild/Guild.tsx @@ -21,6 +21,7 @@ export const Guild: React.FC = (props) => { >
= (props) => { onClick={handleIsConfirmed} > = (props) => {

{member.user.name}

- {member.user.status != null && ( - {member.user.status} - )} + {member.user.status != null && member.user.status}
diff --git a/components/Application/Messages/Message/Message.tsx b/components/Application/Messages/Message/Message.tsx index b33f2e7..244ad68 100644 --- a/components/Application/Messages/Message/Message.tsx +++ b/components/Application/Messages/Message/Message.tsx @@ -25,6 +25,7 @@ export const Message: React.FC = (props) => {
= (props) => { = (props) => { ', () => { = (props) => { onChange={handleTextareaChange} value={message} ref={textareaReference} - autoFocus />
diff --git a/components/Application/UserProfile/UserProfile.tsx b/components/Application/UserProfile/UserProfile.tsx index 0f99925..2a09b8b 100644 --- a/components/Application/UserProfile/UserProfile.tsx +++ b/components/Application/UserProfile/UserProfile.tsx @@ -24,6 +24,7 @@ export const UserProfile: React.FC = (props) => {
{ @@ -45,7 +46,7 @@ export const UserSettings: React.FC = () => { validateSchema: { name: userSchema.name, status: Type.Optional(userSchema.status), - email: Type.Optional(userCurrentSchema.email), + email: Type.Optional(Type.Union([userSchema.email, Type.Null()])), website: Type.Optional(userSchema.website), biography: Type.Optional(userSchema.biography), isPublicGuilds: userSettingsSchema.isPublicGuilds, @@ -63,6 +64,14 @@ export const UserSettings: React.FC = () => { `/users/current?redirectURI=${window.location.origin}/authentication/signin`, userData ) + setInputValues(formData as any) + const hasEmailChanged = user.email !== userCurrentData.user.email + if (hasEmailChanged) { + return { + type: 'success', + value: 'application:success-email-changed' + } + } const { data: userCurrentSettings } = await authentication.api.put( '/users/current/settings', userSettings @@ -74,10 +83,9 @@ export const UserSettings: React.FC = () => { settings: userCurrentSettings.settings } }) - setInputValues(formData as any) return { type: 'success', - value: 'common:name' + value: 'application:saved-information' } } catch (error) { if (axios.isAxiosError(error) && error.response?.status === 400) { @@ -185,6 +193,7 @@ export const UserSettings: React.FC = () => {
{ />
+
+ +
+ + + + + + +
+
+
{ className='w-full justify-center' />
-
- - -
diff --git a/components/Header/Header.tsx b/components/Header/Header.tsx index 3491eb6..3446972 100644 --- a/components/Header/Header.tsx +++ b/components/Header/Header.tsx @@ -12,6 +12,7 @@ export const Header: React.FC = () => {
{ +export interface LanguageProps { + className?: string +} + +export const Language: React.FC = (props) => { + const { className } = props const { lang: currentLanguage } = useTranslation() const [hiddenMenu, setHiddenMenu] = useState(true) @@ -46,7 +51,8 @@ export const Language: React.FC = () => {