generated from yandex-praktikum/middle.messenger.praktikum.yandex
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sprint 3 #3
Merged
Merged
Sprint 3 #3
Changes from all commits
Commits
Show all changes
269 commits
Select commit
Hold shift + click to select a range
e2617e8
refactoring code
Karmyshkov 7ce2a86
added BaseAPI class
Karmyshkov 64c3b7a
refactoring code
Karmyshkov abce4ce
added alias for Api
Karmyshkov 71144c9
changes logic of handleSubmitForm function
Karmyshkov 8dc9f8a
code style
Karmyshkov 18e475c
refactoring BaseAPI class
Karmyshkov 67d2e6d
added AuthAPI class
Karmyshkov 4311306
refactoring code
Karmyshkov bef14e0
fixed error
Karmyshkov 9b1c002
added sugnup function
Karmyshkov 4c25dd9
added alias for services
Karmyshkov fea81d3
added service for Auth
Karmyshkov 82f2240
added auth services
Karmyshkov 47fa6d6
refactoring code
Karmyshkov 6eb40d0
decomposed code
Karmyshkov ccf249a
fixed readme
Karmyshkov f0fc398
added tooltip
Karmyshkov 997a4db
fixed error
Karmyshkov f3ba838
added getMessageFromResponse function
Karmyshkov 44dde1a
changes AuthAPI class
Karmyshkov 7cdcbd2
decomposed code
Karmyshkov 5d4c871
fixed error
Karmyshkov 03d056a
added close tooltip by click
Karmyshkov af6b00d
change regexp for phone
Karmyshkov 0b3749b
fixed style
Karmyshkov dbb2c63
fixed logic of auth service
Karmyshkov f1ae584
added work with sign(in/up)
Karmyshkov 4cc7191
added add chat popup element
Karmyshkov 4cc3015
refactoring popup component
Karmyshkov c06720e
added formValidator for add chat form
Karmyshkov 2f00bf8
refactoring btnProfile component
Karmyshkov 6261ee5
added event click for signout
Karmyshkov 2e3aecc
added signout function
Karmyshkov c5cab47
decomposed code
Karmyshkov 6d0bc86
refactoring code
Karmyshkov 5456c04
added ChatApi
Karmyshkov 238c5ac
added ChatService
Karmyshkov 001fc17
added logic for created of chat
Karmyshkov 2348c5b
fixed HTTPTransport class
Karmyshkov 805c258
replace hardcode on DTA
Karmyshkov c21f287
refactoring code
Karmyshkov 55c32ff
added filtered chats
Karmyshkov d9710b1
clear code
Karmyshkov 3f6f969
fixed render error
Karmyshkov aee0bb7
decomposed code
Karmyshkov accac09
fixed errors
Karmyshkov 1fef886
refactoring code
Karmyshkov 13bc52d
fixed style
Karmyshkov e715210
added put method in BaseApi
Karmyshkov f93b04a
added ProfileApi
Karmyshkov 5dc5dd1
added ProfileService
Karmyshkov 3d4f8ff
added exports for created of ProfileApi
Karmyshkov c288056
fixed error, change type of request
Karmyshkov c063a3c
fixed InputFile component
Karmyshkov fe5ee87
refactoring code
Karmyshkov d82348a
clear code
Karmyshkov 358f43a
fixed error in HTTPTransplort class
Karmyshkov 5591bd9
added changeAvatar method in ProfileService
Karmyshkov 8b1a061
added export for ProfileService
Karmyshkov c15b990
added put method in BaseAPI
Karmyshkov a5bc1af
added changeAvatar in ProfileApi
Karmyshkov 08bc9b2
refactoring code
Karmyshkov b2dbcf3
refactoring code
Karmyshkov db6c578
refactoring code
Karmyshkov 01924d0
added base url for resources
Karmyshkov f733206
fixed style for change avatar
Karmyshkov e151bba
fixed url for avatar image
Karmyshkov e9a6d5c
refactoring code
Karmyshkov 27f6a40
fixed error
Karmyshkov cd0ebf9
changed logic workink with HTTPTransport
Karmyshkov ad110c5
clear auth service
Karmyshkov c2b05ec
fixed style
Karmyshkov 1c9f2a7
clear code
Karmyshkov 260b30b
refactoring code
Karmyshkov 15db99b
decomposed code
Karmyshkov 23b1ed5
refactoring signin page
Karmyshkov cf34d68
refactoring signup page
Karmyshkov 885e2dc
fixed error (white screen)
Karmyshkov 277b200
decomposed code
Karmyshkov dc30c8c
changes BtnBackProfile component
Karmyshkov 8d8f8a0
refactoring code
Karmyshkov f70a8fc
added onClick event for BtnBackProfile component
Karmyshkov e70e1f2
fixed code
Karmyshkov b2275aa
changes edit profile page
Karmyshkov 50fd289
cchanges edit password page
Karmyshkov 8afe370
fixed style for profile page
Karmyshkov 14941a6
changes profile page
Karmyshkov ecb2662
refactoring BtnProfile component
Karmyshkov 63552b6
refactoring code
Karmyshkov 9b15ec8
refactoring code
Karmyshkov cf65bce
clear code
Karmyshkov ec62a9b
added logic working with change user info
Karmyshkov 96136f7
added changeUserPassword in ProfileApi
Karmyshkov de01fe4
added changeUserPassword in ProfileService
Karmyshkov 05f11f4
added logic change of password
Karmyshkov b8371e8
refactoring code
Karmyshkov 2cc2eb1
added ui for deleted chat
Karmyshkov 5695f06
addded delete method in BaseAPI
Karmyshkov 198dd78
added base api and service for remove chat logic
Karmyshkov 948a5d9
fixed error
Karmyshkov d2e1a01
fixed bag
Karmyshkov 0bffec7
refactoring signin page
Karmyshkov 6c76ef0
refactoring signup page
Karmyshkov 28b7eb9
refactoring chats page
Karmyshkov a378d2f
refactoring profile page
Karmyshkov 3e01c74
refactoring edit password page
Karmyshkov a7231db
refactoring edit profile page
Karmyshkov 343ce52
refactoring service files
Karmyshkov 6b08180
added api and service for find user by login
Karmyshkov 27860ed
fixed actions for popup
Karmyshkov 1a2bb1b
added logic searching user by login
Karmyshkov f75970c
rename constant
Karmyshkov 8090b21
improvements app
Karmyshkov c6d4de5
fixed base styles
Karmyshkov 86c289c
added style for popup
Karmyshkov aa16fb4
added addUserToChat for ChatApi
Karmyshkov 642842a
added addUserToChat for ChatService
Karmyshkov 07ba14c
code style
Karmyshkov 17a84d3
refactoring code
Karmyshkov 0d8c901
clear code
Karmyshkov 03d4123
refactoring code
Karmyshkov 3f7d81a
refactoring code for tooltip
Karmyshkov 426efaf
fixed service
Karmyshkov 68e9b57
refactoring code
Karmyshkov 5ba5415
fixed error
Karmyshkov 6a3dde8
clear code
Karmyshkov 7fa3496
refactoring code
Karmyshkov 368ce97
refactoring code
Karmyshkov 942237b
fixed bug margin
Karmyshkov 34ecd8b
fixed style
Karmyshkov fe50de0
fixed submit function
Karmyshkov 015177a
added onClick props for UserItem component
Karmyshkov 1c0e248
added onClick props for UserItem component
Karmyshkov b6f19cf
rename constants
Karmyshkov 00a18ad
added data attribute
Karmyshkov 6926769
fixed bug
Karmyshkov 7f7003d
addded logic rendering current chat name and chat avatar
Karmyshkov 956125e
clear code
Karmyshkov 1fe3d0c
fixed errors
Karmyshkov 9082591
fixed style
Karmyshkov a1a12b4
refactoring components
Karmyshkov 0b36bbb
refactoring services
Karmyshkov 18e2438
fixed MessagesService
Karmyshkov 83bf6dc
added getChatToken method in ChatApi
Karmyshkov 42ec8db
added getChatToken method in ChatService
Karmyshkov ed48d65
added GetChatToken type
Karmyshkov 673a713
added logic taked chat of token
Karmyshkov f8f3d06
refactoring api
Karmyshkov b0f1954
added onSubmit prop for ChatFooter component
Karmyshkov 6be6e80
refactoring types
Karmyshkov 2879350
rename types
Karmyshkov ad891c3
clear code
Karmyshkov 65a3900
rename types
Karmyshkov ecfdeb0
rename types
Karmyshkov 605949c
refactoring BaseApi
Karmyshkov 0e2caf5
clear code in AuthService
Karmyshkov 31b7402
clear code in ChatService
Karmyshkov 66f2819
clear code in ProfileService
Karmyshkov dc15bbd
added checking on matched password
Karmyshkov e1b7ec5
clear code
Karmyshkov da4d7d1
deleted data folder
Karmyshkov 571ac40
refactoring code
Karmyshkov 836f448
refactoring getChatToken method
Karmyshkov e97d758
refactoring searchUserByLogin method
Karmyshkov 19e21cf
refactoring errors
Karmyshkov 8f180dd
refactoring code
Karmyshkov e51c2d1
added saved created chat
Karmyshkov 830ce45
fixed error
Karmyshkov 2d936f2
fixed chat
Karmyshkov f8c7732
fixed time
Karmyshkov 9c7afbd
refactoring code
Karmyshkov 20f85a4
changed rendering logic for ListItem
Karmyshkov df4b5e0
refactoring MessagesService
Karmyshkov 5c88491
clear code
Karmyshkov c364421
fixed scroll bottom
Karmyshkov b17f0b9
clear code
Karmyshkov d7a0f0b
decomposed code
Karmyshkov b30b420
fixed style for Menu component
Karmyshkov 9a50e24
added getUniqDateFromMessages/getIdUniqDates functions
Karmyshkov 669f977
fixed style for Message component
Karmyshkov 9b35fe2
added date for message
Karmyshkov a16549d
fixed types
Karmyshkov 45f069f
added tooltip for add user to chat
Karmyshkov cf87cbd
clear code
Karmyshkov f0531b2
added getUserForChat method in ChatService and ChatApi
Karmyshkov ee5e603
fixed style
Karmyshkov ba1fbfe
refactoring code
Karmyshkov 968655a
fixed deleted user from chat form
Karmyshkov ddd169f
added logic deleted user from chat
Karmyshkov 8bef8ac
fixed logic working deleted user from chat
Karmyshkov 861ba4d
fixed logic deleted chat
Karmyshkov 0c596c1
fixed logic added user to chat
Karmyshkov 7482244
fixed logic added user to chat
Karmyshkov 17551ec
clear code
Karmyshkov 9dfdd01
refactoring Route
Karmyshkov 1e7b702
refactoring code
Karmyshkov 02e4e91
added check on isLoginIn
Karmyshkov 8af8a5c
fixed style for UserItem component
Karmyshkov 7a3c00a
fixed error
Karmyshkov 906b2ba
decomposed code
Karmyshkov 7c263e7
refactoring ChatApi
Karmyshkov 2bc42e2
fixed error
Karmyshkov ee177a9
clear code
Karmyshkov e3a8597
change setState from Store
Karmyshkov 7285a13
changed bugs
Karmyshkov 27e6b2b
added types
Karmyshkov 58bacf8
fixed types
Karmyshkov 1fcc9ae
refactoring types
Karmyshkov 094878d
refactoring type
Karmyshkov a6e9b99
clear code
Karmyshkov 20b4e6f
fixed bug
Karmyshkov 3226bf1
fixed error
Karmyshkov 376e983
added prop role for UserList component
Karmyshkov c0ab3fd
fixed error
Karmyshkov 3cb91a0
code style
Karmyshkov 6ff6765
refactoring code
Karmyshkov 28d603e
fixed netlify config
Karmyshkov a0d2523
added logic working with not found page
Karmyshkov ab74e0f
fixed readme
Karmyshkov 45e7555
clear code in AuthAPI
Karmyshkov e1d2fdd
clear code in AuthService
Karmyshkov 6bd2890
refactoring BaseAPI
Karmyshkov fa0039b
refactoring code
Karmyshkov 7142b53
code style
Karmyshkov 77600a3
refactoring code
Karmyshkov 3d468df
refactoring redirect method
Karmyshkov 2da04bf
rename StoreEvents
Karmyshkov 3f51055
clear code
Karmyshkov 24e8cdb
fixed error
Karmyshkov af66f5e
fixed readme
Karmyshkov 658e937
refactoring code
Karmyshkov 582966d
refactoring constants
Karmyshkov 59bf3e8
deleted isEqual function
Karmyshkov 0ca0773
decomposed code
Karmyshkov ba3e107
decomposed code
Karmyshkov a1c4b5b
decomposed code
Karmyshkov 66b9e4a
refactoring code
Karmyshkov d8444db
fixed error
Karmyshkov 133b0b5
decomposed code
Karmyshkov 1dbae09
decomposed code
Karmyshkov 5845b25
refactoring code
Karmyshkov 07587a3
fixed types
Karmyshkov 210860a
clear code
Karmyshkov 2370d9c
fixed types
Karmyshkov 2a4a72e
fixed error
Karmyshkov b853e78
refactoring code
Karmyshkov c0934c3
refactoring code
Karmyshkov e8fc698
refactoring code
Karmyshkov 2cd6c3a
Merge branch 'main' into sprint_3
Karmyshkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { BaseAPI } from './BaseAPI'; | ||
import { SignupType, SigninType } from 'types'; | ||
|
||
class AuthAPI extends BaseAPI { | ||
constructor() { | ||
super({ path: '/auth' }); | ||
} | ||
|
||
public signup({ ...rest }: SignupType) { | ||
return this.post('signup', { ...rest }); | ||
} | ||
|
||
public signin({ ...rest }: SigninType) { | ||
return this.post('signin', { ...rest }); | ||
} | ||
public signout() { | ||
return this.post('logout', {}); | ||
} | ||
|
||
public getInfo() { | ||
return this.get('user'); | ||
} | ||
} | ||
|
||
export default new AuthAPI(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { HTTPTransport } from 'utils/classes'; | ||
import { URLS, HEADERS } from 'utils/constants'; | ||
|
||
export abstract class BaseAPI { | ||
private _http: HTTPTransport; | ||
private _baseUrl: string; | ||
private _headers: Record<string, string>; | ||
|
||
constructor({ path }: Record<string, string>) { | ||
this._http = new HTTPTransport(); | ||
this._baseUrl = `${URLS.BASE}${path}`; | ||
this._headers = HEADERS.CT_APPLICATION_JSON; | ||
} | ||
|
||
post(url: string, data: unknown) { | ||
return this._http.post(`${this._baseUrl}/${url}`, { headers: this._headers, data }); | ||
} | ||
|
||
get(url: string) { | ||
return this._http.get(`${this._baseUrl}/${url}`, { headers: this._headers }); | ||
} | ||
|
||
put(url: string, data: unknown, headers?: unknown) { | ||
return this._http.put(`${this._baseUrl}/${url}`, { | ||
headers: headers ? headers : this._headers, | ||
data, | ||
}); | ||
} | ||
|
||
delete(url: string, data: unknown) { | ||
return this._http.delete(`${this._baseUrl}/${url}`, { headers: this._headers, data }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { BaseAPI } from './BaseAPI'; | ||
import { | ||
CreateChatType, | ||
RemoveChatType, | ||
AddUserToChatType, | ||
GetChatTokenType, | ||
GetUserForChatType, | ||
RemoveUserFromChat, | ||
} from 'types'; | ||
|
||
class ChatApi extends BaseAPI { | ||
constructor() { | ||
super({ path: '/chats' }); | ||
} | ||
|
||
public createChat({ ...rest }: CreateChatType) { | ||
return this.post('', { ...rest }); | ||
} | ||
|
||
public getChats() { | ||
return this.get(''); | ||
} | ||
|
||
public removeChatById({ ...rest }: RemoveChatType) { | ||
return this.delete('', { ...rest }); | ||
} | ||
|
||
public addUserToChat({ ...rest }: AddUserToChatType) { | ||
return this.put('users', { ...rest }); | ||
} | ||
|
||
public getChatToken({ chatId }: GetChatTokenType) { | ||
return this.post(`token/${chatId}`, {}); | ||
} | ||
|
||
public getUserForChat({ chatId }: GetUserForChatType) { | ||
return this.get(`${chatId}/users`); | ||
} | ||
|
||
public removeUserFromChat({ ...rest }: RemoveUserFromChat) { | ||
return this.delete('users', { ...rest }); | ||
} | ||
} | ||
|
||
export default new ChatApi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { BaseAPI } from './BaseAPI'; | ||
import { UserInfoDTO, UserPasswordType, SearchUserByLoginType } from 'types'; | ||
|
||
class ProfileApi extends BaseAPI { | ||
constructor() { | ||
super({ path: '/user' }); | ||
} | ||
|
||
public changeAvatar(avatar: FormData) { | ||
return this.put('/profile/avatar', avatar, {}); | ||
} | ||
|
||
public changeUserInfo(userInfo: UserInfoDTO) { | ||
return this.put('/profile', userInfo); | ||
} | ||
|
||
public changeUserPassword(userPassword: UserPasswordType) { | ||
return this.put('/password', userPassword); | ||
} | ||
|
||
public searchUserByLogin({ login }: SearchUserByLoginType) { | ||
return this.post('/search', login); | ||
} | ||
} | ||
|
||
export default new ProfileApi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default as authAPI } from './AuthAPI'; | ||
export { default as chatApi } from './ChatApi'; | ||
export { default as profileApi } from './ProfileApi'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.auth-link { | ||
cursor: pointer; | ||
background-color: transparent; | ||
border: none; | ||
margin: 0 auto; | ||
display: block; | ||
font-size: 11px; | ||
color: var(--color-secondary); | ||
font-weight: 500; | ||
line-height: 11px; | ||
transition: 0.3s opacity; | ||
|
||
&:hover { | ||
opacity: 0.8; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Block } from 'core'; | ||
import './authLink.css'; | ||
import { AuthLinkProps } from './types'; | ||
|
||
export class AuthLink extends Block { | ||
static componentName = 'AuthLink'; | ||
|
||
constructor({ onClick, ...rest }: AuthLinkProps) { | ||
super({ events: { click: onClick }, ...rest }); | ||
} | ||
|
||
protected getStateFromProps(props: AuthLinkProps): void { | ||
this.state = { | ||
text: props.text, | ||
}; | ||
} | ||
|
||
protected render(): string { | ||
const { text } = this.state; | ||
// language=hbs | ||
return ` | ||
<Button class="auth-link" type="button">${text}</Button> | ||
`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AuthLink as default } from './authLink'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface AuthLinkProps { | ||
onClick: () => void; | ||
text: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export interface BtnBackProfileProps { | ||
href: string; | ||
onClick: () => void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понял, а почему undefined и null строками? Если бы они были не строками, можно было бы просто проверить
srcAvatar ?
${BASE_URL_RESOURCES}${srcAvatar}: defaultIcon