From b2ef469072a10a9fc80243e09d0ce685567088f3 Mon Sep 17 00:00:00 2001 From: SpaghettiOverload Date: Tue, 20 Jun 2023 13:23:38 +0300 Subject: [PATCH] address lint errors --- .eslintrc.js | 22 +- .../allowlist/allowlist.controller.spec.ts | 20 +- .../src/allowlist/allowlist.controller.ts | 92 ++-- .../backend/src/allowlist/allowlist.module.ts | 8 +- .../src/allowlist/allowlist.service.spec.ts | 20 +- .../src/allowlist/allowlist.service.ts | 25 +- apps/backend/src/allowlist/allowlist.types.ts | 50 +- .../src/allowlist/dto/create-allowlist.dto.ts | 43 +- .../src/allowlist/dto/join-allowlist.dto.ts | 2 +- .../src/allowlist/dto/signed-message.dto.ts | 43 +- .../src/allowlist/guards/can-edit.guard.ts | 2 +- .../src/allowlist/guards/is-admin.guard.ts | 31 +- .../allowlist/pipes/create-allowlist.pipe.ts | 74 +-- .../allowlist/pipes/edit-allowlist.pipe.ts | 2 +- .../src/allowlist/pipes/is-admin.pipe.ts | 56 +- .../src/allowlist/pipes/sign-message.pipe.ts | 56 +- .../src/allowlist/repos/allowlist.repo.ts | 58 +- apps/backend/src/app.module.ts | 110 ++-- apps/backend/src/auth/auth.controller.spec.ts | 20 +- apps/backend/src/auth/auth.controller.ts | 158 +++--- apps/backend/src/auth/auth.middleware.ts | 32 +- apps/backend/src/auth/auth.module.ts | 12 +- apps/backend/src/auth/auth.service.spec.ts | 20 +- apps/backend/src/auth/auth.service.ts | 112 ++-- .../src/auth/guards/discord-auth.guard.ts | 2 +- .../src/auth/strategies/discord.strategy.ts | 42 +- .../src/auth/strategies/twitter.strategy.ts | 68 +-- .../backend/src/common/common.interceptors.ts | 48 +- apps/backend/src/common/utils.ts | 2 +- .../src/discord/discord.controller.spec.ts | 2 +- .../backend/src/discord/discord.controller.ts | 56 +- apps/backend/src/discord/discord.module.ts | 8 +- .../src/discord/discord.service.spec.ts | 20 +- apps/backend/src/discord/discord.service.ts | 18 +- apps/backend/src/main.ts | 82 +-- .../src/twitter/twitter.controller.spec.ts | 2 +- .../backend/src/twitter/twitter.controller.ts | 95 ++-- apps/backend/src/twitter/twitter.module.ts | 8 +- .../src/twitter/twitter.service.spec.ts | 20 +- apps/backend/src/twitter/twitter.service.ts | 17 +- apps/backend/src/user/repos/user.repo.ts | 41 +- apps/backend/src/user/user.controller.spec.ts | 20 +- apps/backend/src/user/user.module.ts | 18 +- apps/backend/src/user/user.service.spec.ts | 20 +- apps/backend/src/user/user.service.ts | 2 +- apps/backend/src/user/user.types.ts | 22 +- .../src/websocket/websocket.gateway.ts | 11 +- apps/backend/test/app.e2e-spec.ts | 28 +- apps/common/interfaces.ts | 13 +- apps/frontend/src/core/api/axios.ts | 4 +- apps/frontend/src/core/api/calls.ts | 7 +- apps/frontend/src/core/api/endpoints.ts | 50 +- .../ModalComponents/WalletSelector/styles.ts | 12 +- .../presentation/components/Dialog/styles.ts | 2 +- .../presentation/components/Layout/styles.ts | 100 ++-- .../components/SearchBar/styles.ts | 41 +- apps/frontend/src/core/store/allowlist.ts | 4 +- apps/frontend/src/core/store/index.ts | 2 +- apps/frontend/src/core/store/modals.ts | 2 +- apps/frontend/src/core/store/search.ts | 3 +- .../src/core/store/socialMediaActions.ts | 14 +- apps/frontend/src/core/store/user.ts | 4 +- apps/frontend/src/core/theme/colors.ts | 287 +++++----- apps/frontend/src/core/theme/index.ts | 503 +++++++++--------- apps/frontend/src/core/theme/themeStyles.ts | 20 +- .../CustomHooks/useManipulateAllowlist.tsx | 8 +- .../presentation/components/helpers.tsx | 12 +- .../allowlists/presentation/pages/styles.ts | 76 +-- .../features/app-routes/entities/AppRoutes.ts | 14 +- .../presentation/components/Home/styles.ts | 64 +-- apps/frontend/src/types/custom.d.ts | 4 +- apps/frontend/src/types/fonts.d.ts | 2 +- 72 files changed, 1470 insertions(+), 1498 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 37ea963..9c5e399 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -50,16 +50,20 @@ module.exports = { "radix": 0, "no-plusplus": "off", "no-bitwise": "off", - "no-undef": [ "error" ], - "prefer-destructuring": [ "error", { "array": false, "object": false }, { "enforceForRenamedProperties": false } ], - "max-len": [ "error", { "code": 1000 } ], - "indent": [ "error", 4, { "SwitchCase": 1 } ], + "no-undef": ["error"], + "prefer-destructuring": ["error", { "array": false, "object": false }, { "enforceForRenamedProperties": false }], + "max-len": ["error", { "code": 1000 }], + "indent": ["error", 4, { "SwitchCase": 1 }], "semi": "off", "no-unused-vars": "off", - "no-console": [ "warn", { "allow": [ "log", "warn", "error" ] } ], - "no-empty": [ "error", { "allowEmptyCatch": true } ], + "@typescript-eslint/no-unused-vars": "off", + "no-console": ["warn", { "allow": ["log", "warn", "error"] }], + "no-empty": ["error", { "allowEmptyCatch": true }], + "no-empty-function": ["error", { + "allow": ["constructors"] + }], "no-fallthrough": "warn", - "quotes": [ "warn", "single" ], + "quotes": ["warn", "single"], "one-var": "off", "one-var-declaration-per-line": "off", "nonblock-statement-body-position": "off", @@ -74,12 +78,12 @@ module.exports = { "no-multi-assign": "off", "dot-notation": "off", "newline-per-chained-call": "off", - "import/extensions": [ "error", "ignorePackages", { + "import/extensions": ["error", "ignorePackages", { "js": "never", "jsx": "never", "ts": "never", "tsx": "never" - } ], + }], "import/prefer-default-export": "off", "max-classes-per-file": "off" }, diff --git a/apps/backend/src/allowlist/allowlist.controller.spec.ts b/apps/backend/src/allowlist/allowlist.controller.spec.ts index ba2147e..56024f5 100644 --- a/apps/backend/src/allowlist/allowlist.controller.spec.ts +++ b/apps/backend/src/allowlist/allowlist.controller.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { AllowlistController } from './allowlist.controller'; describe('AllowlistController', () => { - let controller: AllowlistController; + let controller: AllowlistController; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [AllowlistController], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [AllowlistController], + }).compile(); - controller = module.get(AllowlistController); - }); + controller = module.get(AllowlistController); + }); - it('should be defined', () => { - expect(controller).toBeDefined(); - }); + it('should be defined', () => { + expect(controller).toBeDefined(); + }); }); diff --git a/apps/backend/src/allowlist/allowlist.controller.ts b/apps/backend/src/allowlist/allowlist.controller.ts index 69b6871..8691820 100644 --- a/apps/backend/src/allowlist/allowlist.controller.ts +++ b/apps/backend/src/allowlist/allowlist.controller.ts @@ -1,16 +1,16 @@ import { - Body, - Controller, - Get, - Param, - ParseIntPipe, - Post, - Put, - Req, - Request, - UnauthorizedException, - UseGuards, - UseInterceptors, + Body, + Controller, + Get, + Param, + ParseIntPipe, + Post, + Put, + Req, + Request, + UnauthorizedException, + UseGuards, + UseInterceptors, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { TransactionInterceptor } from '../common/common.interceptors'; @@ -30,20 +30,20 @@ import { SignedMessageDto } from './dto/signed-message.dto'; @ApiTags('Allowlist') @Controller('allowlist') export class AllowlistController { - constructor(private allowlistService: AllowlistService) { } + constructor(private allowlistService: AllowlistService) { } @Get('all') - async findAll(): Promise { - return this.allowlistService.findAll(); - } + async findAll(): Promise { + return this.allowlistService.findAll(); + } @Get(':allowlistId/user/joined') async isUserJoinedAllowlist( @Req() req, @Param('allowlistId') allowlistId: number, ): Promise { - const sessionUserId = req.session.user?.id as number - return this.allowlistService.isUserJoinedAllowlist(allowlistId, sessionUserId); + const sessionUserId = req.session.user?.id as number + return this.allowlistService.isUserJoinedAllowlist(allowlistId, sessionUserId); } @Get(':allowlistId/user/address/:address') @@ -52,40 +52,40 @@ export class AllowlistController { @Param('allowlistId') allowlistId: number, @Param('address') address: string, ): Promise<{ userEntity: UserEntity }> { - const userEntity = await this.allowlistService.getUserByAllowlistIdAndAddress(allowlistId, address); + const userEntity = await this.allowlistService.getUserByAllowlistIdAndAddress(allowlistId, address); - return { - userEntity, - } + return { + userEntity, + } } @Get(':customId') async findByCustomId( @Param('customId') customId: string, ): Promise { - return this.allowlistService.findByCustomId(customId); + return this.allowlistService.findByCustomId(customId); } @Get('/id/:id') async findById( @Param('id', ParseIntPipe) id: number, ): Promise<{ allowlistEntity: AllowlistEntity }> { - const allowlistEntity = await this.allowlistService.findOne(id); + const allowlistEntity = await this.allowlistService.findOne(id); - return { - allowlistEntity, - } + return { + allowlistEntity, + } } @Get() async findByAdmin(@Request() req): Promise { - return this.allowlistService.findByAdmin(req.session.user.address); + return this.allowlistService.findByAdmin(req.session.user.address); } @Get('entries/:id') @UseGuards(IsAdminGuard) async getEntries(@Param('id', ParseIntPipe) id: number) { - return this.allowlistService.getEntries(id); + return this.allowlistService.getEntries(id); } @UseInterceptors(TransactionInterceptor) @@ -95,24 +95,24 @@ export class AllowlistController { @Req() req, @Body(SignMessagePipe) joinAllowlistDto: JoinAllowlistDto, ) { - const sessionUser = req.session.user - // update user record - const allowlistUser = await this.allowlistService.joinAllowlist( - id, - joinAllowlistDto.connectedAddress, - joinAllowlistDto.userEmail, - sessionUser, - ); - return allowlistUser + const sessionUser = req.session.user + // update user record + const allowlistUser = await this.allowlistService.joinAllowlist( + id, + joinAllowlistDto.connectedAddress, + joinAllowlistDto.userEmail, + sessionUser, + ); + return allowlistUser } @UseInterceptors(TransactionInterceptor) @Post() async create( @Body(SignMessagePipe, CreateAllowlistPipe) - createAllowlistDto: CreateAllowlistDto, + createAllowlistDto: CreateAllowlistDto, ): Promise { - return this.allowlistService.createAllowlist(createAllowlistDto); + return this.allowlistService.createAllowlist(createAllowlistDto); } @UseInterceptors(TransactionInterceptor) @@ -125,11 +125,11 @@ export class AllowlistController { @Body(SignMessagePipe) signedData: SignedMessageDto, @Body(EditAllowlistPipe) updateAllowlistDto: UpdateAllowlistDto, ): Promise { - // If we reach here, we are guarantied a valid allowlist admin in the session by the "IsAdminGuard" - // and valid signer by "SignMessagePipe". We only have to compare them. - if (req.session.user.address === signedData.connectedAddress) { - return this.allowlistService.updateAllowlist(id, updateAllowlistDto); - } - throw new UnauthorizedException('Invalid admin'); + // If we reach here, we are guarantied a valid allowlist admin in the session by the "IsAdminGuard" + // and valid signer by "SignMessagePipe". We only have to compare them. + if (req.session.user.address === signedData.connectedAddress) { + return this.allowlistService.updateAllowlist(id, updateAllowlistDto); + } + throw new UnauthorizedException('Invalid admin'); } } diff --git a/apps/backend/src/allowlist/allowlist.module.ts b/apps/backend/src/allowlist/allowlist.module.ts index 40ff276..6d08769 100644 --- a/apps/backend/src/allowlist/allowlist.module.ts +++ b/apps/backend/src/allowlist/allowlist.module.ts @@ -8,9 +8,9 @@ import { DiscordModule } from '../discord/discord.module'; import { TwitterModule } from '../twitter/twitter.module'; @Module({ - imports: [SequelizeModule.forFeature([AllowlistRepo]), UserModule, DiscordModule, TwitterModule], - providers: [AllowlistService], - controllers: [AllowlistController], - exports: [SequelizeModule], + imports: [SequelizeModule.forFeature([AllowlistRepo]), UserModule, DiscordModule, TwitterModule], + providers: [AllowlistService], + controllers: [AllowlistController], + exports: [SequelizeModule], }) export class AllowlistModule {} diff --git a/apps/backend/src/allowlist/allowlist.service.spec.ts b/apps/backend/src/allowlist/allowlist.service.spec.ts index 894a72a..6cfdf6f 100644 --- a/apps/backend/src/allowlist/allowlist.service.spec.ts +++ b/apps/backend/src/allowlist/allowlist.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { AllowlistService } from './allowlist.service'; describe('AllowlistService', () => { - let service: AllowlistService; + let service: AllowlistService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [AllowlistService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [AllowlistService], + }).compile(); - service = module.get(AllowlistService); - }); + service = module.get(AllowlistService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/apps/backend/src/allowlist/allowlist.service.ts b/apps/backend/src/allowlist/allowlist.service.ts index 2270364..904db0e 100644 --- a/apps/backend/src/allowlist/allowlist.service.ts +++ b/apps/backend/src/allowlist/allowlist.service.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-shadow */ import { BadRequestException, Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/sequelize'; import axios from 'axios'; @@ -20,7 +21,7 @@ export class AllowlistService { private allowlistRepo: typeof AllowlistRepo, private userService: UserService, private discordService: DiscordService, - private twitterService: TwitterService + private twitterService: TwitterService, ) { } async getUserByAllowlistIdAndAddress(allowlistId: number, address: string): Promise { @@ -90,7 +91,7 @@ export class AllowlistService { id: number, updateCollectionDto: UpdateAllowlistDto, ): Promise { - const [count, [allowlistRepo]] = await this.allowlistRepo.update( + const [_count, [allowlistRepo]] = await this.allowlistRepo.update( { ...updateCollectionDto }, { where: { id }, returning: true }, ); @@ -111,9 +112,8 @@ export class AllowlistService { if (registeredUsers.includes(userId)) { return allowlistEntity; } - const updatedList = allowlistEntity.users.push(`${userId}`); - const [count, [updatedAllowlistRepo]] = await this.allowlistRepo.update( + const [_count, [updatedAllowlistRepo]] = await this.allowlistRepo.update( { users: allowlistEntity.users }, { where: { id }, returning: true }, ); @@ -161,7 +161,7 @@ export class AllowlistService { if (allowlistEntity.tweet_to_retweet) { const retweeted = await this.twitterService.isTweetRetweeted( allowlistEntity.tweet_to_retweet, - user.twitter_profile_id + user.twitter_profile_id, ); if (!retweeted) { throw new BadRequestException(`Criteria not met: ${TWITTER_API_MSGS.NotRetweetedTweet}`); @@ -211,6 +211,7 @@ export class AllowlistService { }), ); + // eslint-disable-next-line no-restricted-syntax for (const u of users) { if ( user.discord_profile_id @@ -279,9 +280,9 @@ export class AllowlistService { return { id: user.id, address: user.address, - email: user.email || "Not provided", - twitter_handle: user.twitter_profile_id || "Not provided", - discord_handle: user.discord_profile_id || "Not provided", + email: user.email || 'Not provided', + twitter_handle: user.twitter_profile_id || 'Not provided', + discord_handle: user.discord_profile_id || 'Not provided', }; }); }), @@ -289,8 +290,8 @@ export class AllowlistService { } async updateUserInfo(user, sessionUser) { - let sessionTwitterUser = sessionUser.twitter - let sessionDiscordUser = sessionUser.discord + const sessionTwitterUser = sessionUser.twitter + const sessionDiscordUser = sessionUser.discord if (sessionTwitterUser) { delete sessionTwitterUser.email @@ -313,8 +314,8 @@ export class AllowlistService { const newUser = { ...sessionDiscordUser, ...sessionTwitterUser, - address: user.address + address: user.address, } - return await this.userService.updateUser(user.id, newUser) + return this.userService.updateUser(user.id, newUser) } } diff --git a/apps/backend/src/allowlist/allowlist.types.ts b/apps/backend/src/allowlist/allowlist.types.ts index 072035b..ec308bb 100644 --- a/apps/backend/src/allowlist/allowlist.types.ts +++ b/apps/backend/src/allowlist/allowlist.types.ts @@ -1,75 +1,75 @@ import { - IsBoolean, - IsDateString, - IsNumber, - IsOptional, - IsString, - IsArray, + IsBoolean, + IsDateString, + IsNumber, + IsOptional, + IsString, + IsArray, } from 'class-validator'; export class AllowlistJSONValidator { @IsNumber() - id: number; + id: number; @IsString() - admin: string; + admin: string; @IsArray() @IsString({ each: true }) - users: string[]; + users: string[]; @IsString() - name: string; + name: string; @IsString() - url: string; + url: string; @IsString() @IsOptional() - description: string; + description: string; @IsString() - cosmos_chain_id: string; + cosmos_chain_id: string; @IsString() - website: string; + website: string; @IsString() - twitter_account: string; + twitter_account: string; @IsString() - discord_url: string; + discord_url: string; @IsDateString() - end_date: Date; + end_date: Date; @IsString() - image: string; + image: string; @IsString() - banner_image: string; + banner_image: string; @IsString() @IsOptional() - twitter_account_to_follow: string; + twitter_account_to_follow: string; @IsString() @IsOptional() - tweet_to_like: string; + tweet_to_like: string; @IsString() @IsOptional() - tweet_to_retweet: string; + tweet_to_retweet: string; @IsString() @IsOptional() - discord_invite_link: string; + discord_invite_link: string; @IsString() @IsOptional() - server_role: string; + server_role: string; @IsBoolean() @IsOptional() - require_email: boolean; + require_email: boolean; } diff --git a/apps/backend/src/allowlist/dto/create-allowlist.dto.ts b/apps/backend/src/allowlist/dto/create-allowlist.dto.ts index 5cdd9da..39c4f75 100644 --- a/apps/backend/src/allowlist/dto/create-allowlist.dto.ts +++ b/apps/backend/src/allowlist/dto/create-allowlist.dto.ts @@ -1,10 +1,10 @@ import { ApiProperty } from '@nestjs/swagger'; import { - IsString, - IsNotEmpty, - IsOptional, - IsDateString, - IsBoolean, + IsString, + IsNotEmpty, + IsOptional, + IsDateString, + IsBoolean, } from 'class-validator'; import { SignedMessageDto } from './signed-message.dto'; @@ -12,79 +12,78 @@ export class CreateAllowlistDto extends SignedMessageDto { @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - name: string; + name: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - url: string; + url: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - description: string; + description: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - cosmos_chain_id: string; + cosmos_chain_id: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - website: string; + website: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - twitter_account: string; + twitter_account: string; @IsString() @IsNotEmpty() @ApiProperty({ required: true }) - discord_url: string; + discord_url: string; @IsDateString() @IsNotEmpty() @ApiProperty({ required: true }) - end_date: Date; - + end_date: Date; @IsNotEmpty() @ApiProperty({ required: true }) - image: string; + image: string; @IsNotEmpty() @ApiProperty({ required: true }) - banner_image: string; + banner_image: string; @IsString() @IsOptional() @ApiProperty({ required: false }) - twitter_account_to_follow: string; + twitter_account_to_follow: string; @IsString() @IsOptional() @ApiProperty({ required: false }) - tweet_to_like: string; + tweet_to_like: string; @IsString() @IsOptional() @ApiProperty({ required: false }) - tweet_to_retweet: string; + tweet_to_retweet: string; @IsString() @IsOptional() @ApiProperty({ required: false }) - discord_invite_link: string; + discord_invite_link: string; @IsString() @IsOptional() @ApiProperty({ required: false }) - server_role: string; + server_role: string; @IsBoolean() @IsOptional() @ApiProperty({ required: false }) - require_email: boolean; + require_email: boolean; } diff --git a/apps/backend/src/allowlist/dto/join-allowlist.dto.ts b/apps/backend/src/allowlist/dto/join-allowlist.dto.ts index 27b5ae5..7406972 100644 --- a/apps/backend/src/allowlist/dto/join-allowlist.dto.ts +++ b/apps/backend/src/allowlist/dto/join-allowlist.dto.ts @@ -6,5 +6,5 @@ export class JoinAllowlistDto extends SignedMessageDto { @IsEmail() @IsOptional() @ApiProperty({ required: false }) - userEmail: string; + userEmail: string; } diff --git a/apps/backend/src/allowlist/dto/signed-message.dto.ts b/apps/backend/src/allowlist/dto/signed-message.dto.ts index a981457..445e6a0 100644 --- a/apps/backend/src/allowlist/dto/signed-message.dto.ts +++ b/apps/backend/src/allowlist/dto/signed-message.dto.ts @@ -1,36 +1,23 @@ import { ApiProperty } from '@nestjs/swagger'; import { - IsString, - IsNotEmpty, + IsString, + IsNotEmpty, } from 'class-validator'; - -class SignatureDto { - @IsNotEmpty() - @ApiProperty({ required: true }) - pub_key: Object; - - @IsNotEmpty() - @ApiProperty({ required: true }) - type: string; - - @IsNotEmpty() - @ApiProperty({ required: true }) - signature: string; -} +import { StdSignature } from 'cudosjs'; export class SignedMessageDto { - @IsNotEmpty() - @ApiProperty({ required: true }) - @ApiProperty() - signature: Object; + @IsNotEmpty() + @ApiProperty({ required: true }) + @ApiProperty() + signature: StdSignature; - @IsString() - @IsNotEmpty() - @ApiProperty({ required: true }) - message: string; + @IsString() + @IsNotEmpty() + @ApiProperty({ required: true }) + message: string; - @IsString() - @IsNotEmpty() - @ApiProperty({ required: true }) - connectedAddress: string; + @IsString() + @IsNotEmpty() + @ApiProperty({ required: true }) + connectedAddress: string; } diff --git a/apps/backend/src/allowlist/guards/can-edit.guard.ts b/apps/backend/src/allowlist/guards/can-edit.guard.ts index efb765d..a01ed63 100644 --- a/apps/backend/src/allowlist/guards/can-edit.guard.ts +++ b/apps/backend/src/allowlist/guards/can-edit.guard.ts @@ -19,7 +19,7 @@ export class CanEditGuard implements CanActivate { throw new NotFoundException('Allowlist not found') } - if (!!allowlistFound.users.length) { + if (allowlistFound.users.length) { throw new ForbiddenException('Cannot edit if users already joined') } diff --git a/apps/backend/src/allowlist/guards/is-admin.guard.ts b/apps/backend/src/allowlist/guards/is-admin.guard.ts index 415cf04..09bccc2 100644 --- a/apps/backend/src/allowlist/guards/is-admin.guard.ts +++ b/apps/backend/src/allowlist/guards/is-admin.guard.ts @@ -5,24 +5,23 @@ import AllowlistEntity from '../entities/allowlist.entity'; @Injectable() export class IsAdminGuard implements CanActivate { - constructor(private allowlistService: AllowlistService) { } + constructor(private allowlistService: AllowlistService) { } - async canActivate(context: ExecutionContext): Promise { - const request = context.switchToHttp().getRequest(); - const { session, params } = request; + async canActivate(context: ExecutionContext): Promise { + const request = context.switchToHttp().getRequest(); + const { session, params } = request; - if (!session || !params) return false; + if (!session || !params) return false; - if (!session.user || !session.user.address) { - throw new UnauthorizedException(AUTH_API_MSGS.NoUserSession) - } - const allowlistId = parseInt(params.id); + if (!session.user || !session.user.address) { + throw new UnauthorizedException(AUTH_API_MSGS.NoUserSession) + } + const allowlistId = parseInt(params.id); - return this.allowlistService - .findOne(allowlistId) - .then( - (allowlistEnity: AllowlistEntity) => - allowlistEnity.admin === session.user.address, - ); - } + return this.allowlistService + .findOne(allowlistId) + .then( + (allowlistEnity: AllowlistEntity) => allowlistEnity.admin === session.user.address, + ); + } } diff --git a/apps/backend/src/allowlist/pipes/create-allowlist.pipe.ts b/apps/backend/src/allowlist/pipes/create-allowlist.pipe.ts index f6b94e8..dabb2ff 100644 --- a/apps/backend/src/allowlist/pipes/create-allowlist.pipe.ts +++ b/apps/backend/src/allowlist/pipes/create-allowlist.pipe.ts @@ -1,8 +1,8 @@ import { - PipeTransform, - Injectable, - ArgumentMetadata, - BadRequestException, + PipeTransform, + Injectable, + ArgumentMetadata, + BadRequestException, } from '@nestjs/common'; import AppRoutes from '../../../../frontend/src/features/app-routes/entities/AppRoutes'; @@ -11,42 +11,42 @@ import { CreateAllowlistDto } from '../dto/create-allowlist.dto'; @Injectable() export class CreateAllowlistPipe implements PipeTransform { - constructor(private twitterService: TwitterService) { } - async transform(value: CreateAllowlistDto, metadata: ArgumentMetadata) { - if ( - value.twitter_account_to_follow || - value.tweet_to_like || - value.tweet_to_retweet || - value.discord_invite_link - ) { + constructor(private twitterService: TwitterService) { } + async transform(value: CreateAllowlistDto, metadata: ArgumentMetadata) { + if ( + value.twitter_account_to_follow + || value.tweet_to_like + || value.tweet_to_retweet + || value.discord_invite_link + ) { - if (value.twitter_account) { - const isValid = await this.twitterService.isExistingTwitterAcc(value.twitter_account) - if (!isValid) { - throw new BadRequestException('Invalid Allowlist Twitter Account'); - } - if (value.twitter_account && !value.twitter_account.startsWith('@')) { - value.twitter_account = `@${value.twitter_account}` - } - } + if (value.twitter_account) { + const isValid = await this.twitterService.isExistingTwitterAcc(value.twitter_account) + if (!isValid) { + throw new BadRequestException('Invalid Allowlist Twitter Account'); + } + if (value.twitter_account && !value.twitter_account.startsWith('@')) { + value.twitter_account = `@${value.twitter_account}` + } + } - if (value.twitter_account_to_follow) { - const isValid = await this.twitterService.isExistingTwitterAcc(value.twitter_account_to_follow) - if (!isValid) { - throw new BadRequestException('Invalid Twitter Account To Follow'); - } - if (!value.twitter_account_to_follow.startsWith('@')) { - value.twitter_account_to_follow = `@${value.twitter_account_to_follow}` + if (value.twitter_account_to_follow) { + const isValid = await this.twitterService.isExistingTwitterAcc(value.twitter_account_to_follow) + if (!isValid) { + throw new BadRequestException('Invalid Twitter Account To Follow'); + } + if (!value.twitter_account_to_follow.startsWith('@')) { + value.twitter_account_to_follow = `@${value.twitter_account_to_follow}` + } + } + + const routes = Object.values(AppRoutes).map((route) => route.slice(1)); + if (routes.includes(value.url)) { + throw new BadRequestException('Invalid allowlist url'); + } + return value; } - } - const routes = Object.values(AppRoutes).map((route) => route.slice(1)); - if (routes.includes(value.url)) { - throw new BadRequestException('Invalid allowlist url'); - } - return value; + throw new BadRequestException('Minimum required allowlist criteria not met'); } - - throw new BadRequestException('Minimum required allowlist criteria not met'); - } } diff --git a/apps/backend/src/allowlist/pipes/edit-allowlist.pipe.ts b/apps/backend/src/allowlist/pipes/edit-allowlist.pipe.ts index 8b2a642..815d603 100644 --- a/apps/backend/src/allowlist/pipes/edit-allowlist.pipe.ts +++ b/apps/backend/src/allowlist/pipes/edit-allowlist.pipe.ts @@ -1,5 +1,5 @@ import { - Injectable + Injectable, } from '@nestjs/common'; import { CreateAllowlistPipe } from './create-allowlist.pipe'; diff --git a/apps/backend/src/allowlist/pipes/is-admin.pipe.ts b/apps/backend/src/allowlist/pipes/is-admin.pipe.ts index 4eabbf3..5afdf66 100644 --- a/apps/backend/src/allowlist/pipes/is-admin.pipe.ts +++ b/apps/backend/src/allowlist/pipes/is-admin.pipe.ts @@ -1,8 +1,8 @@ import { - PipeTransform, - Injectable, - ArgumentMetadata, - BadRequestException, + PipeTransform, + Injectable, + ArgumentMetadata, + BadRequestException, } from '@nestjs/common'; import { StdSignature } from 'cudosjs'; import { isValidSignature } from '../../common/utils'; @@ -10,35 +10,35 @@ import { SignedMessageDto } from '../dto/signed-message.dto'; @Injectable() export class IsAdminPipe implements PipeTransform { - async transform(value: SignedMessageDto, metadata: ArgumentMetadata) { - if (!value.signature) { - throw new BadRequestException('Missing signature'); - } + async transform(value: SignedMessageDto, _metadata: ArgumentMetadata) { + if (!value.signature) { + throw new BadRequestException('Missing signature'); + } - if (!value.connectedAddress) { - throw new BadRequestException('Missing address'); - } + if (!value.connectedAddress) { + throw new BadRequestException('Missing address'); + } - if (!value.message) { - throw new BadRequestException('Missing message'); - } + if (!value.message) { + throw new BadRequestException('Missing message'); + } - let validSignature; - try { - validSignature = isValidSignature( + let validSignature; + try { + validSignature = isValidSignature( value.signature as StdSignature, value.connectedAddress, - value.message - ) - } catch (error) { - console.log(error); - throw error; - } + value.message, + ) + } catch (error) { + console.log(error); + throw error; + } - if (!validSignature) { - throw new BadRequestException('Invalid signature'); - } + if (!validSignature) { + throw new BadRequestException('Invalid signature'); + } - return value; - } + return value; + } } diff --git a/apps/backend/src/allowlist/pipes/sign-message.pipe.ts b/apps/backend/src/allowlist/pipes/sign-message.pipe.ts index 6c4cc67..3892424 100644 --- a/apps/backend/src/allowlist/pipes/sign-message.pipe.ts +++ b/apps/backend/src/allowlist/pipes/sign-message.pipe.ts @@ -1,8 +1,8 @@ import { - PipeTransform, - Injectable, - ArgumentMetadata, - BadRequestException, + PipeTransform, + Injectable, + ArgumentMetadata, + BadRequestException, } from '@nestjs/common'; import { StdSignature } from 'cudosjs'; import { isValidSignature } from '../../common/utils'; @@ -10,35 +10,35 @@ import { SignedMessageDto } from '../dto/signed-message.dto'; @Injectable() export class SignMessagePipe implements PipeTransform { - async transform(value: SignedMessageDto, metadata: ArgumentMetadata) { - if (!value.signature) { - throw new BadRequestException('Missing signature'); - } + async transform(value: SignedMessageDto, _metadata: ArgumentMetadata) { + if (!value.signature) { + throw new BadRequestException('Missing signature'); + } - if (!value.connectedAddress) { - throw new BadRequestException('Missing address'); - } + if (!value.connectedAddress) { + throw new BadRequestException('Missing address'); + } - if (!value.message) { - throw new BadRequestException('Missing message'); - } + if (!value.message) { + throw new BadRequestException('Missing message'); + } - let validSignature; - try { - validSignature = isValidSignature( + let validSignature; + try { + validSignature = isValidSignature( value.signature as StdSignature, value.connectedAddress, - value.message - ) - } catch (error) { - console.log(error); - throw error; - } + value.message, + ) + } catch (error) { + console.log(error); + throw error; + } - if (!validSignature) { - throw new BadRequestException('Invalid signature'); - } + if (!validSignature) { + throw new BadRequestException('Invalid signature'); + } - return value; - } + return value; + } } diff --git a/apps/backend/src/allowlist/repos/allowlist.repo.ts b/apps/backend/src/allowlist/repos/allowlist.repo.ts index 45aa4f6..30507d5 100644 --- a/apps/backend/src/allowlist/repos/allowlist.repo.ts +++ b/apps/backend/src/allowlist/repos/allowlist.repo.ts @@ -1,95 +1,95 @@ import { - Column, - Model, - Table, - AllowNull, - PrimaryKey, - Unique, - AutoIncrement, - DataType, + Column, + Model, + Table, + AllowNull, + PrimaryKey, + Unique, + AutoIncrement, + DataType, } from 'sequelize-typescript'; @Table({ - freezeTableName: true, - tableName: 'allowlists', + freezeTableName: true, + tableName: 'allowlists', }) export class AllowlistRepo extends Model { @Unique @PrimaryKey @AutoIncrement @Column - id: number; + id: number; @AllowNull(false) @Column - admin: string; + admin: string; @AllowNull(true) @Column({ type: DataType.ARRAY(DataType.STRING) }) - users: string[]; + users: string[]; @AllowNull(false) @Column - name: string; + name: string; @Unique @AllowNull(true) @Column - url: string; + url: string; @AllowNull(true) @Column - description: string; + description: string; @AllowNull(false) @Column - cosmos_chain_id: string; + cosmos_chain_id: string; @AllowNull(true) @Column - website: string; + website: string; @AllowNull(true) @Column - twitter_account: string; + twitter_account: string; @AllowNull(true) @Column - discord_url: string; + discord_url: string; @AllowNull(false) @Column - end_date: Date; + end_date: Date; @AllowNull(false) @Column - image: string; + image: string; @AllowNull(false) @Column - banner_image: string; + banner_image: string; @AllowNull(true) @Column - twitter_account_to_follow: string; + twitter_account_to_follow: string; @AllowNull(true) @Column - tweet_to_like: string; + tweet_to_like: string; @AllowNull(true) @Column - tweet_to_retweet: string; + tweet_to_retweet: string; @AllowNull(true) @Column - discord_invite_link: string; + discord_invite_link: string; @AllowNull(true) @Column - server_role: string; + server_role: string; @AllowNull(true) @Column - require_email: boolean; + require_email: boolean; } diff --git a/apps/backend/src/app.module.ts b/apps/backend/src/app.module.ts index 786e302..33fbe5f 100644 --- a/apps/backend/src/app.module.ts +++ b/apps/backend/src/app.module.ts @@ -1,9 +1,9 @@ import Path from 'path'; import { - MiddlewareConsumer, - Module, - NestModule, - OnModuleInit, + MiddlewareConsumer, + Module, + NestModule, + OnModuleInit, } from '@nestjs/common'; import { SequelizeModule } from '@nestjs/sequelize'; import { ServeStaticModule } from '@nestjs/serve-static'; @@ -29,66 +29,66 @@ import { TwitterService } from './twitter/twitter.service'; import { TwitterController } from './twitter/twitter.controller'; @Module({ - imports: [ - SequelizeModule.forRootAsync({ - inject: [ConfigService], - useFactory: (config: ConfigService) => { - return { - dialect: 'postgres', - host: config.get('APP_DATABASE_HOST'), - port: config.get('APP_DATABASE_PORT'), - username: config.get('APP_DATABASE_USER'), - password: config.get('APP_DATABASE_PASS'), - database: config.get('APP_DATABASE_DB_NAME'), - autoLoadModels: true, - synchronize: true, - }; - }, - }), - ServeStaticModule.forRoot({ - rootPath: Path.join(__dirname, '..', 'frontend', 'src', 'public'), - }), - ConfigModule.forRoot({ - isGlobal: true, - envFilePath: ['./config/.env'], - load: [ - () => { - const Config = {}; - Object.keys(process.env).forEach((envName) => { - const envNameUppercase = envName.toUpperCase(); - if (envNameUppercase.startsWith('APP_') === false) { - return; - } + imports: [ + SequelizeModule.forRootAsync({ + inject: [ConfigService], + useFactory: (config: ConfigService) => { + return { + dialect: 'postgres', + host: config.get('APP_DATABASE_HOST'), + port: config.get('APP_DATABASE_PORT'), + username: config.get('APP_DATABASE_USER'), + password: config.get('APP_DATABASE_PASS'), + database: config.get('APP_DATABASE_DB_NAME'), + autoLoadModels: true, + synchronize: true, + }; + }, + }), + ServeStaticModule.forRoot({ + rootPath: Path.join(__dirname, '..', 'frontend', 'src', 'public'), + }), + ConfigModule.forRoot({ + isGlobal: true, + envFilePath: ['./config/.env'], + load: [ + () => { + const Config = {}; + Object.keys(process.env).forEach((envName) => { + const envNameUppercase = envName.toUpperCase(); + if (envNameUppercase.startsWith('APP_') === false) { + return; + } - Config[envNameUppercase] = process.env[envName]; - }); - return Config; - }, - ], - }), - AuthModule, - UserModule, - PassportModule.register({ session: true }), - AllowlistModule, - DiscordModule, - TwitterModule - ], - providers: [AppService, AuthService, UserService, AllowlistService, DiscordService, TwitterService, WebsocketGateway], - controllers: [AuthController, AllowlistController, UserController, DiscordController, TwitterController], + Config[envNameUppercase] = process.env[envName]; + }); + return Config; + }, + ], + }), + AuthModule, + UserModule, + PassportModule.register({ session: true }), + AllowlistModule, + DiscordModule, + TwitterModule, + ], + providers: [AppService, AuthService, UserService, AllowlistService, DiscordService, TwitterService, WebsocketGateway], + controllers: [AuthController, AllowlistController, UserController, DiscordController, TwitterController], }) export class AppModule implements NestModule, OnModuleInit { - constructor(private readonly discordService: DiscordService) { } + constructor(private readonly discordService: DiscordService) { } - async onModuleInit() { - await this.discordService.connect(); - } + async onModuleInit() { + await this.discordService.connect(); + } - configure(consumer: MiddlewareConsumer) { + configure(_consumer: MiddlewareConsumer) { // remove auth middleware for now - we don't need it // consumer // .apply(AuthMiddleware) // .exclude({ path: '/api/v1/auth/login', method: RequestMethod.POST }) // .forRoutes('/'); - } + } } diff --git a/apps/backend/src/auth/auth.controller.spec.ts b/apps/backend/src/auth/auth.controller.spec.ts index 27a31e6..7010d75 100644 --- a/apps/backend/src/auth/auth.controller.spec.ts +++ b/apps/backend/src/auth/auth.controller.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { AuthController } from './auth.controller'; describe('AuthController', () => { - let controller: AuthController; + let controller: AuthController; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [AuthController], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [AuthController], + }).compile(); - controller = module.get(AuthController); - }); + controller = module.get(AuthController); + }); - it('should be defined', () => { - expect(controller).toBeDefined(); - }); + it('should be defined', () => { + expect(controller).toBeDefined(); + }); }); diff --git a/apps/backend/src/auth/auth.controller.ts b/apps/backend/src/auth/auth.controller.ts index 4e085a0..7c03283 100644 --- a/apps/backend/src/auth/auth.controller.ts +++ b/apps/backend/src/auth/auth.controller.ts @@ -1,12 +1,13 @@ import { - Controller, - Req, - Res, - Get, - UseGuards, - Post, - UseInterceptors, - Body + Controller, + Req, + Res, + Get, + UseGuards, + Post, + UseInterceptors, + Body, + SetMetadata, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { SignedMessageDto } from '../allowlist/dto/signed-message.dto'; @@ -17,89 +18,92 @@ import { DiscordAuthGuard } from './guards/discord-auth.guard'; import { TwitterAuthGuard } from './guards/twitter-auth.guard'; import { DiscordService } from '../discord/discord.service'; import { WebsocketGateway } from '../websocket/websocket.gateway'; -import { WS_MSGS, WS_ROOM } from 'apps/common/interfaces'; -import { SetMetadata } from '@nestjs/common'; +import { WS_MSGS, WS_ROOM } from '../../../common/interfaces'; @SetMetadata('isPublic', true) @ApiTags('Auth') @Controller('auth') export class AuthController { - constructor( - private authService: AuthService, - private discordService: DiscordService, - private websocketGateway: WebsocketGateway - ) { } + constructor( + private authService: AuthService, + private discordService: DiscordService, + private websocketGateway: WebsocketGateway, + ) { } - @UseInterceptors(TransactionInterceptor) - @Post('login') - async login( - @Req() req, - @Res() res, - @Body(SignMessagePipe) signedMessageDto: SignedMessageDto, - ) { - const user = await this.authService.login(signedMessageDto.connectedAddress); - req.session.user = user; - res.status(200) - res.send({ - userId: user.id - }) - } - - @Get('discord/login') - @UseGuards(DiscordAuthGuard) - async discordLogin() { } + @UseInterceptors(TransactionInterceptor) + @Post('login') + async login( + @Req() req, + @Res() res, + @Body(SignMessagePipe) signedMessageDto: SignedMessageDto, + ) { + const user = await this.authService.login(signedMessageDto.connectedAddress); + req.session.user = user; + res.status(200) + res.send({ + userId: user.id, + }) + } - @Get('discord/logout') - async discordLogOut(@Req() req) { - if (req.session.user && req.session.user.discord) { - req.session.user.discord = undefined; + @Get('discord/login') + @UseGuards(DiscordAuthGuard) + async discordLogin() { + // This function intentionally left empty } - } - @Get('discord/callback') - @UseGuards(DiscordAuthGuard) - async discordCallback(@Req() req, @Res() res) { - const user = req.user - if (req.query?.guild_id) { - user.guild = await this.discordService.getGuildInfoByGuildId(req.query.guild_id) + @Get('discord/logout') + async discordLogOut(@Req() req) { + if (req.session.user && req.session.user.discord) { + req.session.user.discord = undefined; + } } - if (req.session.user) { - req.session.user.discord = user; - } else { - req.session.user = { - discord: user - } + + @Get('discord/callback') + @UseGuards(DiscordAuthGuard) + async discordCallback(@Req() req, @Res() res) { + const user = req.user + if (req.query?.guild_id) { + user.guild = await this.discordService.getGuildInfoByGuildId(req.query.guild_id) + } + if (req.session.user) { + req.session.user.discord = user; + } else { + req.session.user = { + discord: user, + } + } + this.websocketGateway.sendMessageToClient( + WS_ROOM.socialMediaEvents, + WS_MSGS.socialMediaSuccess, + ) + res.send(''); } - this.websocketGateway.sendMessageToClient( - WS_ROOM.socialMediaEvents, - WS_MSGS.socialMediaSuccess - ) - res.send(``); - } - @Get('twitter/login') - @UseGuards(TwitterAuthGuard) - async twitterLogin() { } + @Get('twitter/login') + @UseGuards(TwitterAuthGuard) + async twitterLogin() { + // This function intentionally left empty + } - @Get('twitter/logout') - async twitterLogOut(@Req() req) { - if (req.session.user && req.session.user.twitter) { - req.session.user.twitter = undefined; + @Get('twitter/logout') + async twitterLogOut(@Req() req) { + if (req.session.user && req.session.user.twitter) { + req.session.user.twitter = undefined; + } } - } - @Get('twitter/callback') - @UseGuards(TwitterAuthGuard) - async twitterCallback(@Req() req, @Res() res) { - if (req.session.user) { - req.session.user.twitter = req.user; - } else { - req.session.user = { twitter: req.user } + @Get('twitter/callback') + @UseGuards(TwitterAuthGuard) + async twitterCallback(@Req() req, @Res() res) { + if (req.session.user) { + req.session.user.twitter = req.user; + } else { + req.session.user = { twitter: req.user } + } + this.websocketGateway.sendMessageToClient( + WS_ROOM.socialMediaEvents, + WS_MSGS.socialMediaSuccess, + ) + res.send(''); } - this.websocketGateway.sendMessageToClient( - WS_ROOM.socialMediaEvents, - WS_MSGS.socialMediaSuccess - ) - res.send(``); - } } diff --git a/apps/backend/src/auth/auth.middleware.ts b/apps/backend/src/auth/auth.middleware.ts index 4ef2add..898b32b 100644 --- a/apps/backend/src/auth/auth.middleware.ts +++ b/apps/backend/src/auth/auth.middleware.ts @@ -1,26 +1,26 @@ import { - Injectable, - NestMiddleware, - UnauthorizedException, + Injectable, + NestMiddleware, + UnauthorizedException, } from '@nestjs/common'; import { Response, NextFunction } from 'express'; import { UserService } from '../user/user.service'; @Injectable() export class AuthMiddleware implements NestMiddleware { - constructor(private userService: UserService) {} + constructor(private userService: UserService) { } - async use(req: any, res: Response, next: NextFunction) { - // const user = req.session.user; - // if (req.originalUrl.startsWith('/api') && !user) { - // throw new UnauthorizedException(); - // } + async use(req: any, res: Response, next: NextFunction) { + // const user = req.session.user; + // if (req.originalUrl.startsWith('/api') && !user) { + // throw new UnauthorizedException(); + // } - // const userExists = await this.userService.findById(user.id); - // if (!userExists) { - // throw new UnauthorizedException(); - // } - // auth middleware should be completely rewriten - next(); - } + // const userExists = await this.userService.findById(user.id); + // if (!userExists) { + // throw new UnauthorizedException(); + // } + // auth middleware should be completely rewriten + next(); + } } diff --git a/apps/backend/src/auth/auth.module.ts b/apps/backend/src/auth/auth.module.ts index 0e6739b..5615b59 100644 --- a/apps/backend/src/auth/auth.module.ts +++ b/apps/backend/src/auth/auth.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; import { DiscordModule } from '../discord/discord.module'; -import { UserModule } from '../user/user.module'; +import { UserModule } from '../user/user.module'; // eslint-disable-line import/no-cycle import { UserService } from '../user/user.service'; import { WebsocketGateway } from '../websocket/websocket.gateway'; import { AuthController } from './auth.controller'; @@ -10,9 +10,9 @@ import { DiscordStrategy } from './strategies/discord.strategy'; import { TwitterStrategy } from './strategies/twitter.strategy'; @Module({ - imports: [UserModule, PassportModule, DiscordModule], - providers: [AuthService, DiscordStrategy, TwitterStrategy, UserService, WebsocketGateway], - controllers: [AuthController], - exports: [AuthService], + imports: [UserModule, PassportModule, DiscordModule], + providers: [AuthService, DiscordStrategy, TwitterStrategy, UserService, WebsocketGateway], + controllers: [AuthController], + exports: [AuthService], }) -export class AuthModule {} +export class AuthModule { } diff --git a/apps/backend/src/auth/auth.service.spec.ts b/apps/backend/src/auth/auth.service.spec.ts index 800ab66..54d48b6 100644 --- a/apps/backend/src/auth/auth.service.spec.ts +++ b/apps/backend/src/auth/auth.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { AuthService } from './auth.service'; describe('AuthService', () => { - let service: AuthService; + let service: AuthService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [AuthService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [AuthService], + }).compile(); - service = module.get(AuthService); - }); + service = module.get(AuthService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/apps/backend/src/auth/auth.service.ts b/apps/backend/src/auth/auth.service.ts index 97322ba..cfc3ab7 100644 --- a/apps/backend/src/auth/auth.service.ts +++ b/apps/backend/src/auth/auth.service.ts @@ -4,70 +4,70 @@ import { UserService } from '../user/user.service'; @Injectable() export class AuthService { - constructor(private readonly usersService: UserService) { } + constructor(private readonly usersService: UserService) { } - async login(address: string): Promise { - const user = await this.usersService.findByAddress(address); + async login(address: string): Promise { + const user = await this.usersService.findByAddress(address); - if (!user) { - return this.usersService.createUser({ address }); - } - - return user; - } + if (!user) { + return this.usersService.createUser({ address }); + } - async validateDiscordUser( - req: any, - accessToken: string, - refreshToken: string, - profile: any, - ): Promise { - const data = {}; - data['discord_access_token'] = accessToken; - data['discord_refresh_token'] = refreshToken; - data['discord_profile_id'] = profile.id; - data[ - 'discord_profile_username' - ] = `${profile.username}#${profile.discriminator}`; - let user - try { - user = await this.usersService.findByDiscordId(profile.id); - //update user record - user = await this.usersService.updateUser(user.id, data); - } catch (error) { - console.log(error) + return user; } - if (!user) { - user = await this.usersService.createUser(data); + async validateDiscordUser( + _req: any, + accessToken: string, + refreshToken: string, + profile: any, + ): Promise { + const data = {}; + data['discord_access_token'] = accessToken; + data['discord_refresh_token'] = refreshToken; + data['discord_profile_id'] = profile.id; + data[ + 'discord_profile_username' + ] = `${profile.username}#${profile.discriminator}`; + let user + try { + user = await this.usersService.findByDiscordId(profile.id); + // update user record + user = await this.usersService.updateUser(user.id, data); + } catch (error) { + console.log(error) + } + + if (!user) { + user = await this.usersService.createUser(data); + } + return user; } - return user; - } - async validateTwitterUser( - req: any, - accessToken: string, - refreshToken: string, - profile: any, - ): Promise { - const data = {}; - data['twitter_access_token'] = accessToken; - data['twitter_refresh_token'] = refreshToken; - data['twitter_profile_id'] = profile.id; - data['twitter_profile_username'] = profile.username; + async validateTwitterUser( + _req: any, + accessToken: string, + refreshToken: string, + profile: any, + ): Promise { + const data = {}; + data['twitter_access_token'] = accessToken; + data['twitter_refresh_token'] = refreshToken; + data['twitter_profile_id'] = profile.id; + data['twitter_profile_username'] = profile.username; - let user - try { - user = await this.usersService.findByTwitterId(profile.id); - //update user record - user = await this.usersService.updateUser(user.id, data); - } catch (error) { - console.log(error) - } + let user + try { + user = await this.usersService.findByTwitterId(profile.id); + // update user record + user = await this.usersService.updateUser(user.id, data); + } catch (error) { + console.log(error) + } - if (!user) { - user = await this.usersService.createUser(data); + if (!user) { + user = await this.usersService.createUser(data); + } + return user; } - return user; - } } diff --git a/apps/backend/src/auth/guards/discord-auth.guard.ts b/apps/backend/src/auth/guards/discord-auth.guard.ts index 516c67d..2534e58 100644 --- a/apps/backend/src/auth/guards/discord-auth.guard.ts +++ b/apps/backend/src/auth/guards/discord-auth.guard.ts @@ -2,4 +2,4 @@ import { Injectable } from '@nestjs/common'; import { AuthGuard } from '@nestjs/passport'; @Injectable() -export class DiscordAuthGuard extends AuthGuard('discord') {} \ No newline at end of file +export class DiscordAuthGuard extends AuthGuard('discord') {} diff --git a/apps/backend/src/auth/strategies/discord.strategy.ts b/apps/backend/src/auth/strategies/discord.strategy.ts index da67a2a..13db7a2 100644 --- a/apps/backend/src/auth/strategies/discord.strategy.ts +++ b/apps/backend/src/auth/strategies/discord.strategy.ts @@ -6,28 +6,28 @@ import UserEntity from '../../user/entities/user.entity'; @Injectable() export class DiscordStrategy extends PassportStrategy(Strategy) { - constructor(private readonly authService: AuthService) { - super({ - clientID: process.env.APP_DISCORD_CLIENT_ID, - clientSecret: process.env.App_Discord_Client_Secret, - callbackURL: process.env.APP_DISCORD_CALLBACK_URL, - scope: ['identify', 'email', 'guilds', 'guilds.members.read'], - passReqToCallback: true, - }); - } + constructor(private readonly authService: AuthService) { + super({ + clientID: process.env.APP_DISCORD_CLIENT_ID, + clientSecret: process.env.App_Discord_Client_Secret, + callbackURL: process.env.APP_DISCORD_CALLBACK_URL, + scope: ['identify', 'email', 'guilds', 'guilds.members.read'], + passReqToCallback: true, + }); + } - async validate(req, accessToken, refreshToken, profile): Promise { - const user = await this.authService.validateDiscordUser( - req, - accessToken, - refreshToken, - profile, - ); + async validate(req, accessToken, refreshToken, profile): Promise { + const user = await this.authService.validateDiscordUser( + req, + accessToken, + refreshToken, + profile, + ); - if (!user) { - throw new UnauthorizedException('User not found'); - } + if (!user) { + throw new UnauthorizedException('User not found'); + } - return user; - } + return user; + } } diff --git a/apps/backend/src/auth/strategies/twitter.strategy.ts b/apps/backend/src/auth/strategies/twitter.strategy.ts index 56fb481..fdbd390 100644 --- a/apps/backend/src/auth/strategies/twitter.strategy.ts +++ b/apps/backend/src/auth/strategies/twitter.strategy.ts @@ -6,41 +6,41 @@ import UserEntity from '../../user/entities/user.entity'; @Injectable() export class TwitterStrategy extends PassportStrategy(Strategy, 'twitter') { - constructor(private readonly authService: AuthService) { - const clientID = process.env.App_Twitter_Client_ID; - const clientSecret = process.env.App_Twitter_Client_Secret; - super({ - clientID, - clientSecret, - callbackURL: process.env.App_Twitter_Callback_Url, - scope: [ - 'users.read', - 'tweet.read', - 'offline.access', - 'follows.read', - 'like.read', - ], - customHeaders: { - Authorization: - 'Basic ' + - Buffer.from(`${clientID}:${clientSecret}`).toString('base64'), - }, - passReqToCallback: true, - }); - } + constructor(private readonly authService: AuthService) { + const clientID = process.env.App_Twitter_Client_ID; + const clientSecret = process.env.App_Twitter_Client_Secret; + super({ + clientID, + clientSecret, + callbackURL: process.env.App_Twitter_Callback_Url, + scope: [ + 'users.read', + 'tweet.read', + 'offline.access', + 'follows.read', + 'like.read', + ], + customHeaders: { + Authorization: + `Basic ${ + Buffer.from(`${clientID}:${clientSecret}`).toString('base64')}`, + }, + passReqToCallback: true, + }); + } - async validate(req, accessToken, refreshToken, profile): Promise { - const user = await this.authService.validateTwitterUser( - req, - accessToken, - refreshToken, - profile, - ); + async validate(req, accessToken, refreshToken, profile): Promise { + const user = await this.authService.validateTwitterUser( + req, + accessToken, + refreshToken, + profile, + ); - if (!user) { - throw new UnauthorizedException('User not found'); - } + if (!user) { + throw new UnauthorizedException('User not found'); + } - return user; - } + return user; + } } diff --git a/apps/backend/src/common/common.interceptors.ts b/apps/backend/src/common/common.interceptors.ts index d2688d9..c30a371 100644 --- a/apps/backend/src/common/common.interceptors.ts +++ b/apps/backend/src/common/common.interceptors.ts @@ -1,8 +1,8 @@ import { - CallHandler, - ExecutionContext, - Injectable, - NestInterceptor, + CallHandler, + ExecutionContext, + Injectable, + NestInterceptor, } from '@nestjs/common'; import { InjectConnection } from '@nestjs/sequelize'; import { Observable, throwError } from 'rxjs'; @@ -11,28 +11,28 @@ import { Sequelize, Transaction } from 'sequelize'; @Injectable() export class TransactionInterceptor implements NestInterceptor { - constructor( + constructor( @InjectConnection() private readonly sequelizeInstance: Sequelize, - ) {} + ) {} - async intercept( - context: ExecutionContext, - next: CallHandler, - ): Promise> { - const httpContext = context.switchToHttp(); - const req = httpContext.getRequest(); + async intercept( + context: ExecutionContext, + next: CallHandler, + ): Promise> { + const httpContext = context.switchToHttp(); + const req = httpContext.getRequest(); - const transaction: Transaction = await this.sequelizeInstance.transaction(); - req.transaction = transaction; - return next.handle().pipe( - tap(() => { - transaction.commit(); - }), - catchError((err) => { - transaction.rollback(); - return throwError(err); - }), - ); - } + const transaction: Transaction = await this.sequelizeInstance.transaction(); + req.transaction = transaction; + return next.handle().pipe( + tap(() => { + transaction.commit(); + }), + catchError((err) => { + transaction.rollback(); + return throwError(err); + }), + ); + } } diff --git a/apps/backend/src/common/utils.ts b/apps/backend/src/common/utils.ts index 43088a9..4800505 100644 --- a/apps/backend/src/common/utils.ts +++ b/apps/backend/src/common/utils.ts @@ -1,6 +1,6 @@ import { StdSignature, decodeSignature } from 'cudosjs'; import { verifyADR36Amino } from '@keplr-wallet/cosmos'; -import { bech32 } from "bech32" +import { bech32 } from 'bech32' export const NOT_EXISTS_INT = -2147483648; diff --git a/apps/backend/src/discord/discord.controller.spec.ts b/apps/backend/src/discord/discord.controller.spec.ts index 1100649..22b7a43 100644 --- a/apps/backend/src/discord/discord.controller.spec.ts +++ b/apps/backend/src/discord/discord.controller.spec.ts @@ -8,7 +8,7 @@ describe('DiscordController', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ controllers: [DiscordController], - imports: [DiscordModule] + imports: [DiscordModule], }).compile(); controller = module.get(DiscordController); diff --git a/apps/backend/src/discord/discord.controller.ts b/apps/backend/src/discord/discord.controller.ts index d574198..970a603 100644 --- a/apps/backend/src/discord/discord.controller.ts +++ b/apps/backend/src/discord/discord.controller.ts @@ -1,9 +1,9 @@ import { - Controller, - Res, - Get, - Param, - BadRequestException + Controller, + Res, + Get, + Param, + BadRequestException, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { DiscordService } from './discord.service'; @@ -12,19 +12,19 @@ import { DISCORD_API_MSGS } from '../../../common/interfaces'; @ApiTags('Discord') @Controller('discord') export class DiscordController { - constructor(private discordService: DiscordService) { } + constructor(private discordService: DiscordService) { } - @Get(`guilds/:inviteCode/roles/:roleId/name`) - async getRoleNameByRoleId( + @Get('guilds/:inviteCode/roles/:roleId/name') + async getRoleNameByRoleId( @Param('roleId') roleId: string, @Param('inviteCode') inviteCode: string, - ) { - try { - return this.discordService.getRoleNameByRoleId(inviteCode, roleId) - } catch { - throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) + ) { + try { + return this.discordService.getRoleNameByRoleId(inviteCode, roleId) + } catch { + throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) + } } - } @Get('guild/:code/:userId') async isUserJoinedDiscordGuild( @@ -32,25 +32,25 @@ export class DiscordController { @Param('userId') userId: string, @Res() res, ) { - try { - res.send({ - isUserJoinedDiscordGuild: await this.discordService.isUserJoinedByInvite(code, userId) - }) - } catch (error) { - console.error(error.message) - throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) - } + try { + res.send({ + isUserJoinedDiscordGuild: await this.discordService.isUserJoinedByInvite(code, userId), + }) + } catch (error) { + console.error(error.message) + throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) + } } @Get('invite/:code/guild/name') async getGuildNameByInviteCode( - @Param('code') code: string + @Param('code') code: string, ): Promise { - try { - return this.discordService.getGuildNameByInviteCode(code) - } catch { - throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) - } + try { + return this.discordService.getGuildNameByInviteCode(code) + } catch { + throw new BadRequestException(DISCORD_API_MSGS.ExpiredOrUnknownInvite) + } } } diff --git a/apps/backend/src/discord/discord.module.ts b/apps/backend/src/discord/discord.module.ts index 5325029..ea3540e 100644 --- a/apps/backend/src/discord/discord.module.ts +++ b/apps/backend/src/discord/discord.module.ts @@ -3,9 +3,9 @@ import { DiscordService } from './discord.service'; import { DiscordController } from './discord.controller'; @Module({ - imports: [], - providers: [DiscordService], - controllers: [DiscordController], - exports: [DiscordService], + imports: [], + providers: [DiscordService], + controllers: [DiscordController], + exports: [DiscordService], }) export class DiscordModule {} diff --git a/apps/backend/src/discord/discord.service.spec.ts b/apps/backend/src/discord/discord.service.spec.ts index b011e33..5f35d07 100644 --- a/apps/backend/src/discord/discord.service.spec.ts +++ b/apps/backend/src/discord/discord.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { DiscordService } from './discord.service'; describe('DiscordService', () => { - let service: DiscordService; + let service: DiscordService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [DiscordService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [DiscordService], + }).compile(); - service = module.get(DiscordService); - }); + service = module.get(DiscordService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/apps/backend/src/discord/discord.service.ts b/apps/backend/src/discord/discord.service.ts index 8bcd38f..f515ba4 100644 --- a/apps/backend/src/discord/discord.service.ts +++ b/apps/backend/src/discord/discord.service.ts @@ -9,7 +9,7 @@ import { Guild, Invite, Role, - TextChannel + TextChannel, } from 'discord.js'; @Injectable() @@ -23,8 +23,8 @@ export class DiscordService { GatewayIntentBits.GuildInvites, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildPresences, - GatewayIntentBits.GuildWebhooks - ] + GatewayIntentBits.GuildWebhooks, + ], } this.client = new Client(clientOptions); } @@ -110,7 +110,7 @@ export class DiscordService { return channel.createInvite(inviteOptions) } - //PUBLIC + // PUBLIC async getGuildIdByInviteCode(inviteCode: string): Promise { const guild = await this.getGuildByInviteCode(inviteCode) return guild.id @@ -131,12 +131,8 @@ export class DiscordService { async getRoleNameByRoleId(inviteCode: string, roleId: string): Promise { const guild = await this.getGuildByInviteCode(inviteCode) const feRolePairs = await this.getFeGuildRoles(guild) - for (const [id, name] of Object.entries(feRolePairs)) { - if (id === roleId) { - return name - } - } - return DISCORD_SERVER_ROLES.default + const role = Object.entries(feRolePairs).find(([id, _]) => id === roleId); + return role ? role[1] : DISCORD_SERVER_ROLES.default; } async getGuildInfoByGuildId(guildId: string): Promise { @@ -148,7 +144,7 @@ export class DiscordService { guildName: guild.name, systemChannelId: guild.systemChannelId, guildRoles, - inviteCode + inviteCode, } } } diff --git a/apps/backend/src/main.ts b/apps/backend/src/main.ts index f231806..fec2dbe 100644 --- a/apps/backend/src/main.ts +++ b/apps/backend/src/main.ts @@ -12,53 +12,53 @@ import { GlobalGuard } from './auth/guards/global-auth.guard'; declare const module: any; async function bootstrap() { - const app = await NestFactory.create(AppModule, { - logger: console - }); + const app = await NestFactory.create(AppModule, { + logger: console, + }); - app.useGlobalGuards(new GlobalGuard(new Reflector)); - app.enableCors(); - app.setGlobalPrefix('api'); - app.enableVersioning({ - type: VersioningType.URI, - defaultVersion: '1', - }); - app.use(bodyParser.json({ limit: '50mb' })); - app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); - app.use( - session({ - cookie: { - maxAge: 2147483647, // 2^31 = 2147483647 - }, - secret: 'my-secret', - resave: false, - saveUninitialized: false, - }), - ); + app.useGlobalGuards(new GlobalGuard(new Reflector())); + app.enableCors(); + app.setGlobalPrefix('api'); + app.enableVersioning({ + type: VersioningType.URI, + defaultVersion: '1', + }); + app.use(bodyParser.json({ limit: '50mb' })); + app.use(bodyParser.urlencoded({ limit: '50mb', extended: true })); + app.use( + session({ + cookie: { + maxAge: 2147483647, // 2^31 = 2147483647 + }, + secret: 'my-secret', + resave: false, + saveUninitialized: false, + }), + ); - app.use(passport.initialize()); - app.use(passport.session()); + app.use(passport.initialize()); + app.use(passport.session()); - const config = new DocumentBuilder() - .setTitle('Cudos allowlist tool') - .setDescription('Cudos allowlist tool descrition') - .setVersion('1.0') - .build(); - const document = SwaggerModule.createDocument(app, config); - SwaggerModule.setup('api', app, document); + const config = new DocumentBuilder() + .setTitle('Cudos allowlist tool') + .setDescription('Cudos allowlist tool descrition') + .setVersion('1.0') + .build(); + const document = SwaggerModule.createDocument(app, config); + SwaggerModule.setup('api', app, document); - const configService = app.get(ConfigService); - const appPort = configService.get('APP_PORT'); - await app.listen(appPort); + const configService = app.get(ConfigService); + const appPort = configService.get('APP_PORT'); + await app.listen(appPort); - if (module.hot) { - module.hot.accept(); - module.hot.dispose(() => app.close()); - } + if (module.hot) { + module.hot.accept(); + module.hot.dispose(() => app.close()); + } - process.on('unhandledRejection', error => { - console.error('Unhandled promise rejection:', error); - }); + process.on('unhandledRejection', (error) => { + console.error('Unhandled promise rejection:', error); + }); } bootstrap(); diff --git a/apps/backend/src/twitter/twitter.controller.spec.ts b/apps/backend/src/twitter/twitter.controller.spec.ts index 424b607..e92f8ee 100644 --- a/apps/backend/src/twitter/twitter.controller.spec.ts +++ b/apps/backend/src/twitter/twitter.controller.spec.ts @@ -8,7 +8,7 @@ describe('TwitterController', () => { beforeEach(async () => { const module: TestingModule = await Test.createTestingModule({ controllers: [TwitterController], - imports: [TwitterModule] + imports: [TwitterModule], }).compile(); controller = module.get(TwitterController); diff --git a/apps/backend/src/twitter/twitter.controller.ts b/apps/backend/src/twitter/twitter.controller.ts index 8ce9f93..5256e2c 100644 --- a/apps/backend/src/twitter/twitter.controller.ts +++ b/apps/backend/src/twitter/twitter.controller.ts @@ -1,65 +1,64 @@ import { - Controller, - Res, - Get, - Param, - BadRequestException + Controller, + Get, + Param, + BadRequestException, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; -import { TWITTER_API_MSGS } from 'apps/common/interfaces'; +import { TWITTER_API_MSGS } from '../../../common/interfaces'; import { TwitterService } from './twitter.service'; @ApiTags('Twitter') @Controller('twitter') export class TwitterController { - constructor(private twitterService: TwitterService) { } + constructor(private twitterService: TwitterService) { } - @Get(`user/:userId/retweeted/tweet/:tweetUrl`) - async isTweetRetweeted( - @Param('userId') userId: string, - @Param('tweetUrl') tweetUrl: string, - ) { - try { - const decodedUrl = decodeURIComponent(tweetUrl) - return this.twitterService.isTweetRetweeted(decodedUrl, userId) - } catch { - throw new BadRequestException(TWITTER_API_MSGS.NotRetweetedTweet) + @Get('user/:userId/retweeted/tweet/:tweetUrl') + async isTweetRetweeted( + @Param('userId') userId: string, + @Param('tweetUrl') tweetUrl: string, + ) { + try { + const decodedUrl = decodeURIComponent(tweetUrl) + return this.twitterService.isTweetRetweeted(decodedUrl, userId) + } catch { + throw new BadRequestException(TWITTER_API_MSGS.NotRetweetedTweet) + } } - } - @Get(`user/:userId/liked/tweet/:tweetUrl`) - async isTweetLiked( - @Param('userId') userId: string, - @Param('tweetUrl') tweetUrl: string, - ) { - try { - const decodedUrl = decodeURIComponent(tweetUrl) - return this.twitterService.isTweetLiked(decodedUrl, userId) - } catch { - throw new BadRequestException(TWITTER_API_MSGS.NotLikedTweet) + @Get('user/:userId/liked/tweet/:tweetUrl') + async isTweetLiked( + @Param('userId') userId: string, + @Param('tweetUrl') tweetUrl: string, + ) { + try { + const decodedUrl = decodeURIComponent(tweetUrl) + return this.twitterService.isTweetLiked(decodedUrl, userId) + } catch { + throw new BadRequestException(TWITTER_API_MSGS.NotLikedTweet) + } } - } - @Get(`user/:userId/following/:accountName`) - async isFollowingTwitterAcc( - @Param('userId') userId: string, - @Param('accountName') accountName: string, - ) { - try { - return this.twitterService.isFollowingTwitterAcc(userId, accountName) - } catch { - throw new BadRequestException(TWITTER_API_MSGS.NotFollowingAcc) + @Get('user/:userId/following/:accountName') + async isFollowingTwitterAcc( + @Param('userId') userId: string, + @Param('accountName') accountName: string, + ) { + try { + return this.twitterService.isFollowingTwitterAcc(userId, accountName) + } catch { + throw new BadRequestException(TWITTER_API_MSGS.NotFollowingAcc) + } } - } - @Get('validate/account/:accountName') - async isExistingTwitterAcc( - @Param('accountName') accountName: string - ) { - try { - return this.twitterService.isExistingTwitterAcc(accountName) - } catch { - throw new BadRequestException(TWITTER_API_MSGS.InvalidAccount) + @Get('validate/account/:accountName') + async isExistingTwitterAcc( + @Param('accountName') accountName: string, + ) { + try { + return this.twitterService.isExistingTwitterAcc(accountName) + } catch { + throw new BadRequestException(TWITTER_API_MSGS.InvalidAccount) + } } - } } diff --git a/apps/backend/src/twitter/twitter.module.ts b/apps/backend/src/twitter/twitter.module.ts index d9b3e4d..49d2639 100644 --- a/apps/backend/src/twitter/twitter.module.ts +++ b/apps/backend/src/twitter/twitter.module.ts @@ -3,9 +3,9 @@ import { TwitterController } from './twitter.controller'; import { TwitterService } from './twitter.service'; @Module({ - imports: [], - providers: [TwitterService], - controllers: [TwitterController], - exports: [TwitterService], + imports: [], + providers: [TwitterService], + controllers: [TwitterController], + exports: [TwitterService], }) export class TwitterModule { } diff --git a/apps/backend/src/twitter/twitter.service.spec.ts b/apps/backend/src/twitter/twitter.service.spec.ts index b371609..c2a69f3 100644 --- a/apps/backend/src/twitter/twitter.service.spec.ts +++ b/apps/backend/src/twitter/twitter.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { TwitterService } from './twitter.service'; describe('TwitterService', () => { - let service: TwitterService; + let service: TwitterService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [TwitterService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [TwitterService], + }).compile(); - service = module.get(TwitterService); - }); + service = module.get(TwitterService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/apps/backend/src/twitter/twitter.service.ts b/apps/backend/src/twitter/twitter.service.ts index 5d27808..32e878e 100644 --- a/apps/backend/src/twitter/twitter.service.ts +++ b/apps/backend/src/twitter/twitter.service.ts @@ -3,13 +3,8 @@ import axios from 'axios'; @Injectable() export class TwitterService { - constructor() { - const twitterCheckUrlMapper = { - } - } - - //PUBLIC + // PUBLIC async isFollowingTwitterAcc( userId: string, accountName: string, @@ -84,13 +79,13 @@ export class TwitterService { let arr = []; let res: any; - let next_token: any; + let nextToken: any; try { do { const params = { max_results: 100 }; - if (next_token) { - params['pagination_token'] = next_token; + if (nextToken) { + params['pagination_token'] = nextToken; } res = await axios.get(url, { @@ -104,8 +99,8 @@ export class TwitterService { const data = res.data.data.map((tweet: any) => tweet.id); arr = arr.concat(data); - next_token = res.data.meta.next_token; - } while (next_token); + nextToken = res.data.meta.next_token; + } while (nextToken); return arr.includes(target); diff --git a/apps/backend/src/user/repos/user.repo.ts b/apps/backend/src/user/repos/user.repo.ts index a927cd5..204a32c 100644 --- a/apps/backend/src/user/repos/user.repo.ts +++ b/apps/backend/src/user/repos/user.repo.ts @@ -1,60 +1,61 @@ import { - Column, - Model, - Table, - AllowNull, - PrimaryKey, - Unique, - AutoIncrement, + Column, + Model, + Table, + AllowNull, + PrimaryKey, + Unique, + AutoIncrement, } from 'sequelize-typescript'; + @Table({ - freezeTableName: true, - tableName: 'users', + freezeTableName: true, + tableName: 'users', }) export class UserRepo extends Model { @Unique @PrimaryKey @AutoIncrement @Column - id: number; + id: number; @AllowNull(true) @Column - address: string; + address: string; @AllowNull(true) @Column - email: string; + email: string; @AllowNull(true) @Column - twitter_profile_id: string; + twitter_profile_id: string; @AllowNull(true) @Column - twitter_profile_username: string; + twitter_profile_username: string; @AllowNull(true) @Column - twitter_access_token: string; + twitter_access_token: string; @AllowNull(true) @Column - twitter_refresh_token: string; + twitter_refresh_token: string; @AllowNull(true) @Column - discord_profile_id: string; + discord_profile_id: string; @AllowNull(true) @Column - discord_profile_username: string; + discord_profile_username: string; @AllowNull(true) @Column - discord_access_token: string; + discord_access_token: string; @AllowNull(true) @Column - discord_refresh_token: string; + discord_refresh_token: string; } diff --git a/apps/backend/src/user/user.controller.spec.ts b/apps/backend/src/user/user.controller.spec.ts index 7057a1a..29280ca 100644 --- a/apps/backend/src/user/user.controller.spec.ts +++ b/apps/backend/src/user/user.controller.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { UserController } from './user.controller'; describe('UserController', () => { - let controller: UserController; + let controller: UserController; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - controllers: [UserController], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + controllers: [UserController], + }).compile(); - controller = module.get(UserController); - }); + controller = module.get(UserController); + }); - it('should be defined', () => { - expect(controller).toBeDefined(); - }); + it('should be defined', () => { + expect(controller).toBeDefined(); + }); }); diff --git a/apps/backend/src/user/user.module.ts b/apps/backend/src/user/user.module.ts index 7b137e0..b2bb0be 100644 --- a/apps/backend/src/user/user.module.ts +++ b/apps/backend/src/user/user.module.ts @@ -1,17 +1,17 @@ import { forwardRef, Module } from '@nestjs/common'; import { SequelizeModule } from '@nestjs/sequelize'; -import { AuthModule } from '../auth/auth.module'; +import { AuthModule } from '../auth/auth.module'; // eslint-disable-line import/no-cycle import { UserRepo } from './repos/user.repo'; import { UserService } from './user.service'; import { UserController } from './user.controller'; @Module({ - imports: [ - SequelizeModule.forFeature([UserRepo]), - forwardRef(() => AuthModule), - ], - providers: [UserService], - exports: [SequelizeModule, UserService], - controllers: [UserController], + imports: [ + SequelizeModule.forFeature([UserRepo]), + forwardRef(() => AuthModule), + ], + providers: [UserService], + exports: [SequelizeModule, UserService], + controllers: [UserController], }) -export class UserModule {} +export class UserModule { } diff --git a/apps/backend/src/user/user.service.spec.ts b/apps/backend/src/user/user.service.spec.ts index 873de8a..2cf76ba 100644 --- a/apps/backend/src/user/user.service.spec.ts +++ b/apps/backend/src/user/user.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { UserService } from './user.service'; describe('UserService', () => { - let service: UserService; + let service: UserService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [UserService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [UserService], + }).compile(); - service = module.get(UserService); - }); + service = module.get(UserService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/apps/backend/src/user/user.service.ts b/apps/backend/src/user/user.service.ts index d1df888..abbdb1b 100644 --- a/apps/backend/src/user/user.service.ts +++ b/apps/backend/src/user/user.service.ts @@ -50,7 +50,7 @@ export class UserService { } async updateUser(id: number, params: any): Promise { - const [count, [userRepo]] = await this.userRepo.update( + const [_count, [userRepo]] = await this.userRepo.update( { ...params, }, diff --git a/apps/backend/src/user/user.types.ts b/apps/backend/src/user/user.types.ts index 558aff4..4200788 100644 --- a/apps/backend/src/user/user.types.ts +++ b/apps/backend/src/user/user.types.ts @@ -2,36 +2,36 @@ import { IsEmail, IsNumber, IsString } from 'class-validator'; export class UserJSONValidator { @IsNumber() - id: number; + id: number; @IsString() - address: string; + address: string; @IsEmail() @IsString() - email: string; + email: string; @IsString() - twitter_profile_id: string; + twitter_profile_id: string; @IsString() - twitter_profile_username: string; + twitter_profile_username: string; @IsString() - twitter_access_token: string; + twitter_access_token: string; @IsString() - twitter_refresh_token: string; + twitter_refresh_token: string; @IsString() - discord_profile_id: string; + discord_profile_id: string; @IsString() - discord_profile_username: string; + discord_profile_username: string; @IsString() - discord_access_token: string; + discord_access_token: string; @IsString() - discord_refresh_token: string; + discord_refresh_token: string; } diff --git a/apps/backend/src/websocket/websocket.gateway.ts b/apps/backend/src/websocket/websocket.gateway.ts index 89e05f3..85d6dc9 100644 --- a/apps/backend/src/websocket/websocket.gateway.ts +++ b/apps/backend/src/websocket/websocket.gateway.ts @@ -1,6 +1,5 @@ -import { WebSocketGateway, WebSocketServer, OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets'; +import { WebSocketGateway, WebSocketServer, OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect, SubscribeMessage } from '@nestjs/websockets'; import { Server, Socket } from 'socket.io'; -import { SubscribeMessage } from '@nestjs/websockets'; import { WS_MSGS, WS_ROOM } from '../../../common/interfaces'; import { UserService } from '../user/user.service'; @@ -15,7 +14,7 @@ export class WebsocketGateway implements OnGatewayInit, OnGatewayConnection, OnG const incomingId = this.decodedId(client.handshake.query.customId) const userAddress = incomingId.split(process.env.APP_WS_ID).pop(); const userFound = await this.userService.findByAddress(userAddress) - let valid = false, usr = "" + let valid = false, usr = '' if (userFound !== null) { valid = incomingId.startsWith(process.env.APP_WS_ID) if (valid) { @@ -34,7 +33,7 @@ export class WebsocketGateway implements OnGatewayInit, OnGatewayConnection, OnG if (!isValid) { client.disconnect(true) - console.log(`Socket Connection refused. Invalid client. Disconnecting...`); + console.log('Socket Connection refused. Invalid client. Disconnecting...'); return } @@ -59,7 +58,7 @@ export class WebsocketGateway implements OnGatewayInit, OnGatewayConnection, OnG console.log(`Client ${user} disconnected`); } - async afterInit(_: Server) { + async afterInit(_server: Server) { console.log('WebSocket server initialized'); } @@ -76,6 +75,6 @@ export class WebsocketGateway implements OnGatewayInit, OnGatewayConnection, OnG } sendMessageToClient(room: WS_ROOM, message: WS_MSGS, type?: any) { - this.server.to(room).emit(type ? type : message, message); + this.server.to(room).emit(type || message, message); } } diff --git a/apps/backend/test/app.e2e-spec.ts b/apps/backend/test/app.e2e-spec.ts index 50cda62..ce86fb8 100644 --- a/apps/backend/test/app.e2e-spec.ts +++ b/apps/backend/test/app.e2e-spec.ts @@ -4,21 +4,21 @@ import * as request from 'supertest'; import { AppModule } from './../src/app.module'; describe('AppController (e2e)', () => { - let app: INestApplication; + let app: INestApplication; - beforeEach(async () => { - const moduleFixture: TestingModule = await Test.createTestingModule({ - imports: [AppModule], - }).compile(); + beforeEach(async () => { + const moduleFixture: TestingModule = await Test.createTestingModule({ + imports: [AppModule], + }).compile(); - app = moduleFixture.createNestApplication(); - await app.init(); - }); + app = moduleFixture.createNestApplication(); + await app.init(); + }); - it('/ (GET)', () => { - return request(app.getHttpServer()) - .get('/') - .expect(200) - .expect('Hello World!'); - }); + it('/ (GET)', () => { + return request(app.getHttpServer()) + .get('/') + .expect(200) + .expect('Hello World!'); + }); }); diff --git a/apps/common/interfaces.ts b/apps/common/interfaces.ts index 4bcbcd7..f0b6a3a 100644 --- a/apps/common/interfaces.ts +++ b/apps/common/interfaces.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-shadow */ export interface GuildInfo { guildId: string; guildName: string; @@ -26,7 +27,7 @@ export const emptyGuildInfo: GuildInfo = { guildName: '', systemChannelId: '', guildRoles: {}, - inviteCode: '' + inviteCode: '', } export enum SOCIAL_MEDIA { @@ -47,7 +48,7 @@ export const emptySocialMedia = { id: '', userName: '', accessToken: '', - guild: emptyGuildInfo + guild: emptyGuildInfo, } export enum DISCORD_SERVER_ROLES { @@ -55,16 +56,16 @@ export enum DISCORD_SERVER_ROLES { } export const DISCORD_API_MSGS = { - ExpiredOrUnknownInvite: 'Expired or Invalid invite' + ExpiredOrUnknownInvite: 'Expired or Invalid invite', } export const AUTH_API_MSGS = { - NoUserSession: 'No User Session' + NoUserSession: 'No User Session', } export const TWITTER_API_MSGS = { InvalidAccount: 'Invalid Account', NotFollowingAcc: 'User Not Following The Specified Account', NotLikedTweet: 'User Not Liked The Specified Tweet', - NotRetweetedTweet: 'User Not Retweeted The Specified Tweet' -} \ No newline at end of file + NotRetweetedTweet: 'User Not Retweeted The Specified Tweet', +} diff --git a/apps/frontend/src/core/api/axios.ts b/apps/frontend/src/core/api/axios.ts index 1b929ce..1955f18 100644 --- a/apps/frontend/src/core/api/axios.ts +++ b/apps/frontend/src/core/api/axios.ts @@ -3,8 +3,8 @@ import { APP_DETAILS } from '../utilities/Constants'; const instance = axios.create({ headers: { - 'x-api-key': APP_DETAILS.API_KEY - } + 'x-api-key': APP_DETAILS.API_KEY, + }, }); export default instance; diff --git a/apps/frontend/src/core/api/calls.ts b/apps/frontend/src/core/api/calls.ts index 6fbb89d..38fce37 100644 --- a/apps/frontend/src/core/api/calls.ts +++ b/apps/frontend/src/core/api/calls.ts @@ -1,7 +1,6 @@ import axios from './axios'; -import { FetchedAllowlist } from "../store/allowlist"; -import { blobToBase64 } from '../../features/allowlists/presentation/components/helpers'; +import { FetchedAllowlist } from '../store/allowlist'; import { SOCIAL_MEDIA } from '../../../../common/interfaces'; import { @@ -20,7 +19,7 @@ import { SOCIAL_MEDIA_LOGOUT_URL, USER_DETAILS_URL, USER_JOINED_ALLOWLIST_URL, - USER_LOGIN_URL + USER_LOGIN_URL, } from './endpoints'; export const IS_FOLLOWING_TWITTER_ACCOUNT = async (userId: string, accountName: string): Promise => { @@ -85,8 +84,6 @@ export const GET_ALLOWLIST_DETAILS = async (allowlistID: string) => { } export const CREATE_ALLOWLIST = async (data: any) => { - data.image = await blobToBase64(data.image) - data.banner_image = await blobToBase64(data.banner_image) return axios.post(ALLOWLIST_URL, data); } diff --git a/apps/frontend/src/core/api/endpoints.ts b/apps/frontend/src/core/api/endpoints.ts index 3493fd9..7962eb3 100644 --- a/apps/frontend/src/core/api/endpoints.ts +++ b/apps/frontend/src/core/api/endpoints.ts @@ -1,51 +1,37 @@ -import { SOCIAL_MEDIA } from "../../../../common/interfaces" +import { SOCIAL_MEDIA } from '../../../../common/interfaces' -export const JOIN_ALLOWLIST_URL = (allowlistID: number) => - `/api/v1/allowlist/join/${allowlistID}` +export const JOIN_ALLOWLIST_URL = (allowlistID: number) => `/api/v1/allowlist/join/${allowlistID}` -export const ALLOWLIST_DETAILS_URL = (allowlistID: string | number) => - `/api/v1/allowlist/${allowlistID}` +export const ALLOWLIST_DETAILS_URL = (allowlistID: string | number) => `/api/v1/allowlist/${allowlistID}` -export const USER_JOINED_ALLOWLIST_URL = (allowlistID: number) => - `/api/v1/allowlist/${allowlistID}/user/joined` +export const USER_JOINED_ALLOWLIST_URL = (allowlistID: number) => `/api/v1/allowlist/${allowlistID}/user/joined` -export const ALLOWLIST_ENTRIES_URL = (allowlistID: number) => - `/api/v1/allowlist/entries/${allowlistID}` +export const ALLOWLIST_ENTRIES_URL = (allowlistID: number) => `/api/v1/allowlist/entries/${allowlistID}` -export const SOCIAL_MEDIA_LOGIN_URL = (service: SOCIAL_MEDIA) => - `/api/v1/auth/${service}/login` +export const SOCIAL_MEDIA_LOGIN_URL = (service: SOCIAL_MEDIA) => `/api/v1/auth/${service}/login` -export const SOCIAL_MEDIA_LOGOUT_URL = (service: SOCIAL_MEDIA) => - `/api/v1/auth/${service}/logout` +export const SOCIAL_MEDIA_LOGOUT_URL = (service: SOCIAL_MEDIA) => `/api/v1/auth/${service}/logout` -export const DISCORD_ROLE_NAME_FROM_ROLE_ID_URL = (inviteCode: string, roleId: string) => - `/api/v1/discord/guilds/${inviteCode}/roles/${roleId}/name` +export const DISCORD_ROLE_NAME_FROM_ROLE_ID_URL = (inviteCode: string, roleId: string) => `/api/v1/discord/guilds/${inviteCode}/roles/${roleId}/name` -export const DISCORD_GUILD_NAME_FROM_INVITE_CODE_URL = (inviteCode: string) => - `/api/v1/discord/invite/${inviteCode}/guild/name` +export const DISCORD_GUILD_NAME_FROM_INVITE_CODE_URL = (inviteCode: string) => `/api/v1/discord/invite/${inviteCode}/guild/name` -export const IS_VALID_TWITTER_ACC_URL = (accountName: string) => - `/api/v1/twitter/validate/account/${accountName}` +export const IS_VALID_TWITTER_ACC_URL = (accountName: string) => `/api/v1/twitter/validate/account/${accountName}` -export const IS_TWEET_RETWEETED_URL = (userId: string, tweetUrl: string) => - `/api/v1/twitter/user/${userId}/retweeted/tweet/${encodeURIComponent(tweetUrl)}` +export const IS_TWEET_RETWEETED_URL = (userId: string, tweetUrl: string) => `/api/v1/twitter/user/${userId}/retweeted/tweet/${encodeURIComponent(tweetUrl)}` -export const IS_TWEET_LIKED_URL = (userId: string, tweetUrl: string) => - `/api/v1/twitter/user/${userId}/liked/tweet/${encodeURIComponent(tweetUrl)}` +export const IS_TWEET_LIKED_URL = (userId: string, tweetUrl: string) => `/api/v1/twitter/user/${userId}/liked/tweet/${encodeURIComponent(tweetUrl)}` -export const IS_FOLLOWING_TWITTER_ACCOUNT_URL = (userId: string, accountName: string) => - `/api/v1/twitter/user/${userId}/following/${accountName}` +export const IS_FOLLOWING_TWITTER_ACCOUNT_URL = (userId: string, accountName: string) => `/api/v1/twitter/user/${userId}/following/${accountName}` -export const DISCORD_MEMBER_JOINED_SERVER_URL = (inviteCode: string, userId: string) => - `/api/v1/discord/guild/${inviteCode}/${userId}` +export const DISCORD_MEMBER_JOINED_SERVER_URL = (inviteCode: string, userId: string) => `/api/v1/discord/guild/${inviteCode}/${userId}` -export const ADD_DISCORD_BOT_URL = (clientId: string, callBackUrl: string) => - `https://discord.com/api/oauth2/authorize?client_id=${clientId}&permissions=0&redirect_uri=${encodeURIComponent(callBackUrl)}&response_type=code&scope=bot%20identify%20email%20guilds%20guilds.members.read` +export const ADD_DISCORD_BOT_URL = (clientId: string, callBackUrl: string) => `https://discord.com/api/oauth2/authorize?client_id=${clientId}&permissions=0&redirect_uri=${encodeURIComponent(callBackUrl)}&response_type=code&scope=bot%20identify%20email%20guilds%20guilds.members.read` -export const ALL_ALLOWLISTS_URL = `/api/v1/allowlist/all` +export const ALL_ALLOWLISTS_URL = '/api/v1/allowlist/all' -export const USER_DETAILS_URL = `/api/v1/user` +export const USER_DETAILS_URL = '/api/v1/user' -export const ALLOWLIST_URL = `/api/v1/allowlist` +export const ALLOWLIST_URL = '/api/v1/allowlist' export const USER_LOGIN_URL = '/api/v1/auth/login' diff --git a/apps/frontend/src/core/presentation/components/Dialog/ModalComponents/WalletSelector/styles.ts b/apps/frontend/src/core/presentation/components/Dialog/ModalComponents/WalletSelector/styles.ts index d5121d5..f056f08 100644 --- a/apps/frontend/src/core/presentation/components/Dialog/ModalComponents/WalletSelector/styles.ts +++ b/apps/frontend/src/core/presentation/components/Dialog/ModalComponents/WalletSelector/styles.ts @@ -1,10 +1,8 @@ -import { COLORS } from "../../../../../../core/theme/colors" - export const styles = { logoHolder: (logoLoaded: boolean, isLoadingComponent?: boolean) => { - let extraStyles = isLoadingComponent ? { + const extraStyles = isLoadingComponent ? { visibility: logoLoaded ? 'hidden' : 'visible', - position: logoLoaded ? 'absolute' : 'relative' + position: logoLoaded ? 'absolute' : 'relative', } : { visibility: logoLoaded ? 'visible' : 'hidden', position: logoLoaded ? 'relative' : 'absolute', @@ -16,12 +14,12 @@ export const styles = { marginRight: '-24px', display: 'flex', justifyContent: 'center', - alignItems: 'center' + alignItems: 'center', } }, logo: { width: '24px', - height: '24px' + height: '24px', }, ovalLoader: { width: '50px', @@ -46,7 +44,7 @@ export const styles = { }, connectButton: { height: '50px', - width: '100%' + width: '100%', }, btnsHolder: { alignItems: 'center', diff --git a/apps/frontend/src/core/presentation/components/Dialog/styles.ts b/apps/frontend/src/core/presentation/components/Dialog/styles.ts index 422cc81..d305b5a 100644 --- a/apps/frontend/src/core/presentation/components/Dialog/styles.ts +++ b/apps/frontend/src/core/presentation/components/Dialog/styles.ts @@ -19,7 +19,7 @@ export const CancelRoundedIcon = styled(CancelRounded)(({ theme }) => ({ cursor: 'pointer', })) -export const ModalContainer = styled(Box)(({ theme }) => ({ +export const ModalContainer = styled(Box)(() => ({ display: 'flex', flexDirection: 'column', alignItems: 'center', diff --git a/apps/frontend/src/core/presentation/components/Layout/styles.ts b/apps/frontend/src/core/presentation/components/Layout/styles.ts index cedc2af..1ee2582 100644 --- a/apps/frontend/src/core/presentation/components/Layout/styles.ts +++ b/apps/frontend/src/core/presentation/components/Layout/styles.ts @@ -1,10 +1,10 @@ -import { COLORS } from "../../../theme/colors"; +import { COLORS } from '../../../theme/colors'; export const headerStyles = { menuIcon: (compensateRightMargin: boolean, hasScrollbar: boolean) => { return { cursor: 'pointer', - marginRight: compensateRightMargin && hasScrollbar ? '4px' : '0px' + marginRight: compensateRightMargin && hasScrollbar ? '4px' : '0px', } }, rightNavContent: (compensateRightMargin: boolean, hasScrollbar: boolean) => { @@ -12,19 +12,19 @@ export const headerStyles = { display: 'flex', alignItems: 'center', flexDirection: 'row', - marginRight: compensateRightMargin && hasScrollbar ? '4px' : '0px' + marginRight: compensateRightMargin && hasScrollbar ? '4px' : '0px', } }, hamburgerAddressHolder: { width: '100%', display: 'flex', flexDirection: 'column', - alignItems: 'flex-start' + alignItems: 'flex-start', }, hamburgerFlexLine: { display: 'flex', alignItems: 'center', - marginLeft: '-10px' + marginLeft: '-10px', }, hamburgerMenuContent: { display: 'flex', @@ -32,7 +32,7 @@ export const headerStyles = { width: '100%', marginBottom: '40px', alignItems: 'flex-start', - flexDirection: 'column' + flexDirection: 'column', }, hamburgerTopWideDivider: { margin: '20px 0px', @@ -41,7 +41,7 @@ export const headerStyles = { position: 'absolute', left: 0, top: '65px', - width: '100vw' + width: '100vw', }, hamburgerBottomWideDivider: { margin: '20px 0px', @@ -49,48 +49,48 @@ export const headerStyles = { backgroundColor: COLORS.STEEL_GRAY[70], position: 'relative', left: '-62px', - width: '100vw' + width: '100vw', }, headerDisabled: { - pointerEvents: "none", + pointerEvents: 'none', }, disconnectBtn: { width: '195px', height: '45px', - borderRadius: '100px' + borderRadius: '100px', }, logoGroup: { opacity: '1', transition: 'all .1s ease-in-out', cursor: 'pointer', display: 'flex', - alignItems: 'center' + alignItems: 'center', }, hamburgerMidDivider: { height: '1px', width: '100%', margin: '10px 0px', borderColor: COLORS.STEEL_GRAY[70], - backgroundColor: COLORS.STEEL_GRAY[70] + backgroundColor: COLORS.STEEL_GRAY[70], }, divider: { height: '24px', borderColor: COLORS.STEEL_GRAY[70], - backgroundColor: COLORS.STEEL_GRAY[70] + backgroundColor: COLORS.STEEL_GRAY[70], }, hamburgerDropDownItemHolder: { cursor: 'pointer', - justifyContent: "center", + justifyContent: 'center', alignItems: 'center', display: 'flex', flexDirection: 'column', - padding: '8px 0px' + padding: '8px 0px', }, dropDownItemHolder: { alignItems: 'center', display: 'flex', flexDirection: 'column', - padding: '8px 0px' + padding: '8px 0px', }, hamburgerDropDownContentHolder: { width: '176px', @@ -98,28 +98,28 @@ export const headerStyles = { padding: '10px 20px', background: COLORS.STEEL_GRAY[90], '&:hover': { - background: COLORS.STEEL_GRAY[80] + background: COLORS.STEEL_GRAY[80], }, '&:click': { - background: COLORS.STEEL_GRAY[70] + background: COLORS.STEEL_GRAY[70], }, fontSize: '14px', fontWeight: '500', borderRadius: '24px', display: 'flex', - alignItems: "center", + alignItems: 'center', justifyContent: 'center', }, dropDownDisconnectBtnHolder: { - display: "flex", - alignItems: "center", + display: 'flex', + alignItems: 'center', padding: '10px 20px', background: COLORS.STEEL_GRAY[90], '&:hover': { - background: COLORS.STEEL_GRAY[80] + background: COLORS.STEEL_GRAY[80], }, '&:click': { - background: COLORS.STEEL_GRAY[70] + background: COLORS.STEEL_GRAY[70], }, fontSize: '14px', width: '176px', @@ -155,8 +155,8 @@ export const headerStyles = { }, holder: { opacity: 1, - backdropFilter: "blur(12px)", - background: "rgba(16, 18, 26, 0.8)", + backdropFilter: 'blur(12px)', + background: 'rgba(16, 18, 26, 0.8)', height: '80px', transition: 'all .3s ease-in-out', padding: '16px 4rem !important', @@ -169,7 +169,7 @@ export const headerStyles = { return { marginLeft: isConnected ? '-6px' : '0px', display: 'flex', - alignItems: 'center' + alignItems: 'center', } }, leftNavContentAndIcon: (hamburgerMenu: boolean) => { @@ -179,7 +179,7 @@ export const headerStyles = { justifyContent: 'space-between', alignItems: 'center', paddingTop: hamburgerMenu ? '8px' : '0px', - marginBottom: hamburgerMenu ? '60px' : '0px' + marginBottom: hamburgerMenu ? '60px' : '0px', } }, hamburger: { @@ -187,8 +187,8 @@ export const headerStyles = { overflowY: 'scroll', overflowX: 'clip', height: '100vh', - backdropFilter: "blur(20px)", - background: "rgba(16, 18, 26, 0.9)", + backdropFilter: 'blur(20px)', + background: 'rgba(16, 18, 26, 0.9)', transition: 'all .3s ease-in-out', padding: '16px 4rem !important', justifyContent: 'space-between', @@ -205,14 +205,14 @@ export const headerStyles = { color: isMenuOpen ? COLORS.LIGHT_BLUE[90] : 'inherit', cursor: 'pointer', background: isMenuOpen ? COLORS.STEEL_GRAY[100] : 'transparent', - borderRadius: "12px", - padding: "9px 10px 2px 11px" + borderRadius: '12px', + padding: '9px 10px 2px 11px', } }, logInBtn: (isConnected: boolean) => { return { - "&:hover": { - bgcolor: isConnected ? COLORS.STEEL_GRAY[80] : 'auto' + '&:hover': { + bgcolor: isConnected ? COLORS.STEEL_GRAY[80] : 'auto', }, bgcolor: isConnected ? COLORS.STEEL_GRAY[90] : COLORS.LIGHT_BLUE[90], justifyContent: isConnected ? 'space-between' : 'center', @@ -230,9 +230,9 @@ export const footerStyles = { typography: { fontWeight: 700, color: COLORS.STEEL_GRAY[50], - "&:hover": { - color: COLORS.LIGHT_BLUE[90] - } + '&:hover': { + color: COLORS.LIGHT_BLUE[90], + }, }, holder: { padding: '1rem 2rem', @@ -240,7 +240,7 @@ export const footerStyles = { bottom: 0, width: '100%', alignItems: 'center', - display: 'flex' + display: 'flex', }, rightItem: { display: 'flex', @@ -249,12 +249,12 @@ export const footerStyles = { cursor: 'pointer', color: COLORS.STEEL_GRAY[50], '&:hover': { - color: COLORS.LIGHT_BLUE[90] - } + color: COLORS.LIGHT_BLUE[90], + }, }, leftItem: { - cursor: 'pointer' - } + cursor: 'pointer', + }, } export const helperStyles = { @@ -262,9 +262,9 @@ export const helperStyles = { display: 'flex', color: COLORS.STEEL_GRAY[50], alignItems: 'center', - "&:hover": { - color: COLORS.LIGHT_BLUE[90] - } + '&:hover': { + color: COLORS.LIGHT_BLUE[90], + }, }, dropDownItem: { width: '100%', @@ -282,8 +282,8 @@ export const helperStyles = { display: 'flex', alignItems: 'center', justifyContent: 'center', - borderRadius: '50%' - } + borderRadius: '50%', + }, } export const layoutStyles = { @@ -294,7 +294,7 @@ export const layoutStyles = { overflowWrap: 'break-word', overflow: 'auto', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, contentHolder: { display: 'flex', @@ -305,6 +305,6 @@ export const layoutStyles = { position: 'relative', display: 'flex', flexDirection: 'column', - minWidth: '650px' - } -} \ No newline at end of file + minWidth: '650px', + }, +} diff --git a/apps/frontend/src/core/presentation/components/SearchBar/styles.ts b/apps/frontend/src/core/presentation/components/SearchBar/styles.ts index f8593f6..a67d507 100644 --- a/apps/frontend/src/core/presentation/components/SearchBar/styles.ts +++ b/apps/frontend/src/core/presentation/components/SearchBar/styles.ts @@ -1,4 +1,4 @@ -import { COLORS } from "../../../theme/colors"; +import { COLORS } from '../../../theme/colors'; export const styles = { sortingOrder: { @@ -10,13 +10,14 @@ export const styles = { height: '48px', borderRadius: '64px', padding: '15px 20px', - border: `1px solid ${COLORS.STEEL_GRAY[70]}` + border: `1px solid ${COLORS.STEEL_GRAY[70]}`, }, cancelIcon: { marginRight: '-10px', marginTop: '5px', cursor: 'pointer', - height: '20px', color: COLORS.STEEL_GRAY[40] + height: '20px', + color: COLORS.STEEL_GRAY[40], }, searchBar: (expandSearchBar: boolean, noResult: boolean, width?: string) => { return { @@ -43,19 +44,19 @@ export const styles = { height: '48px', borderRadius: '10px', width: '100%', - "&:focus": { + '&:focus': { backgroundColor: 'transparent !important', }, - "&:hover": { + '&:hover': { cursor: 'pointer', - backgroundColor: `${COLORS.STEEL_GRAY[90]} !important` + backgroundColor: `${COLORS.STEEL_GRAY[90]} !important`, }, - "&:selected:hover": { - backgroundColor: `${COLORS.STEEL_GRAY[90]} !important` + '&:selected:hover': { + backgroundColor: `${COLORS.STEEL_GRAY[90]} !important`, + }, + '&:focus:hover': { + backgroundColor: `${COLORS.STEEL_GRAY[90]} !important`, }, - "&:focus:hover": { - backgroundColor: `${COLORS.STEEL_GRAY[90]} !important` - } }, chainSelectorDropoDownMenuProps: { PaperProps: { @@ -65,8 +66,8 @@ export const styles = { padding: '8px', display: 'flex', flexDirection: 'column', - gap: '4px' - } + gap: '4px', + }, }, style: { display: 'flex', @@ -85,8 +86,8 @@ export const styles = { padding: '8px', display: 'flex', flexDirection: 'column', - gap: '4px' - } + gap: '4px', + }, }, style: { display: 'flex', @@ -95,14 +96,14 @@ export const styles = { borderRadius: '8px', marginLeft: '8px', minWidth: '192px', - maxWidth: '192px' + maxWidth: '192px', }, }, }, chainSelectorDropDown: { width: '100%', height: '48px', - borderRadius: '64px' + borderRadius: '64px', }, filterDropDown: { padding: '15px 24px 15px 20px', @@ -110,11 +111,11 @@ export const styles = { maxWidth: '192px', height: '48px', border: `1px solid ${COLORS.STEEL_GRAY[70]}`, - borderRadius: '64px' + borderRadius: '64px', }, dropDownPlaceholder: { fontSize: '14px', fontWeight: 600, - color: COLORS.STEEL_GRAY[20] - } + color: COLORS.STEEL_GRAY[20], + }, } diff --git a/apps/frontend/src/core/store/allowlist.ts b/apps/frontend/src/core/store/allowlist.ts index d214319..9a9a882 100644 --- a/apps/frontend/src/core/store/allowlist.ts +++ b/apps/frontend/src/core/store/allowlist.ts @@ -79,8 +79,8 @@ export const initialState: CollectedData = { tweet: false, twitter_account: false, discord_server: false, - server_role: false - } + server_role: false, + }, } export const userAllowlistObjectStateSlice = createSlice({ diff --git a/apps/frontend/src/core/store/index.ts b/apps/frontend/src/core/store/index.ts index 2175093..d7cfca0 100644 --- a/apps/frontend/src/core/store/index.ts +++ b/apps/frontend/src/core/store/index.ts @@ -14,7 +14,7 @@ const rootReducer = combineReducers({ modalState: modalStateReducer, allowlistState: allowlistStateReducer, socialMediaActionsState: socialMediaActionsStateReducer, - searchState: searchStateReducer + searchState: searchStateReducer, }) const persistConfig = { diff --git a/apps/frontend/src/core/store/modals.ts b/apps/frontend/src/core/store/modals.ts index 2616649..0fd9d60 100644 --- a/apps/frontend/src/core/store/modals.ts +++ b/apps/frontend/src/core/store/modals.ts @@ -19,7 +19,7 @@ export const initialState: modalState = { failure: false, message: '', loadingSpinner: false, - ongoingEligibilityCheck: false + ongoingEligibilityCheck: false, } export const modalStateSlice = createSlice({ diff --git a/apps/frontend/src/core/store/search.ts b/apps/frontend/src/core/store/search.ts index e0d0fd1..7a61d7c 100644 --- a/apps/frontend/src/core/store/search.ts +++ b/apps/frontend/src/core/store/search.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-shadow */ import { createSlice, PayloadAction } from '@reduxjs/toolkit' export enum SearchFilter { @@ -19,7 +20,7 @@ export const initialState: searchState = { searchTerms: '', activeSearch: false, appliedFilter: undefined, - ascendingOrder: true + ascendingOrder: true, } export const searchStateSlice = createSlice({ diff --git a/apps/frontend/src/core/store/socialMediaActions.ts b/apps/frontend/src/core/store/socialMediaActions.ts index 668bf42..8af4403 100644 --- a/apps/frontend/src/core/store/socialMediaActions.ts +++ b/apps/frontend/src/core/store/socialMediaActions.ts @@ -1,6 +1,16 @@ +/* eslint-disable no-shadow */ import { createSlice, PayloadAction } from '@reduxjs/toolkit' -import { SocialMediaAction } from '../../features/allowlists/presentation/components/helpers' +export enum SocialMediaAction { + joinDiscordServer = 'joinDiscordServer', + followTwitterAccount = 'followTwitterAccount', + likeTweet = 'likeTweet', + retweetTweet = 'retweetTweet' +} + +export type SocialMediaUserActions = { + [key in SocialMediaAction]: boolean +} export interface socialMediaActionsState { [SocialMediaAction.followTwitterAccount]?: boolean, @@ -13,7 +23,7 @@ export const initialState: socialMediaActionsState = { [SocialMediaAction.followTwitterAccount]: false, [SocialMediaAction.likeTweet]: false, [SocialMediaAction.retweetTweet]: false, - [SocialMediaAction.joinDiscordServer]: false + [SocialMediaAction.joinDiscordServer]: false, } export const socialMediaActionsStateSlice = createSlice({ diff --git a/apps/frontend/src/core/store/user.ts b/apps/frontend/src/core/store/user.ts index 56f9a19..6b5ba68 100644 --- a/apps/frontend/src/core/store/user.ts +++ b/apps/frontend/src/core/store/user.ts @@ -1,4 +1,4 @@ -import { Coin, SUPPORTED_WALLET } from 'cudosjs' +import { SUPPORTED_WALLET } from 'cudosjs' import { createSlice, PayloadAction } from '@reduxjs/toolkit' import { CONNECTED_SOCIAL_MEDIA, emptySocialMedia, SOCIAL_MEDIA } from '../../../../common/interfaces' @@ -21,7 +21,7 @@ export const initialState: userState = { connectedSocialMedia: { [SOCIAL_MEDIA.twitter]: emptySocialMedia, [SOCIAL_MEDIA.discord]: emptySocialMedia, - } + }, } export const userStateSlice = createSlice({ diff --git a/apps/frontend/src/core/theme/colors.ts b/apps/frontend/src/core/theme/colors.ts index b275309..8ad69c9 100644 --- a/apps/frontend/src/core/theme/colors.ts +++ b/apps/frontend/src/core/theme/colors.ts @@ -1,148 +1,149 @@ +/* eslint-disable no-shadow */ export enum COLOR_NAME { - LIGHT_BLUE = 'LIGHT_BLUE', - AQUA = 'AQUA', - STEEL_GRAY = 'STEEL_GRAY', - DARK_BLUE = 'DARK_BLUE', - NEUTRAL = 'NEUTRAL', - GREEN = 'GREEN', - RED = 'RED', - PEACH = 'PEACH', - YELLOW = 'YELLOW', - PURPLE = 'PURPLE', - ORANGE = 'ORANGE' + LIGHT_BLUE = 'LIGHT_BLUE', + AQUA = 'AQUA', + STEEL_GRAY = 'STEEL_GRAY', + DARK_BLUE = 'DARK_BLUE', + NEUTRAL = 'NEUTRAL', + GREEN = 'GREEN', + RED = 'RED', + PEACH = 'PEACH', + YELLOW = 'YELLOW', + PURPLE = 'PURPLE', + ORANGE = 'ORANGE' } export const COLORS = { - [COLOR_NAME.LIGHT_BLUE]: { - 100: '#298EF1', - 90: '#52A6F8', - 80: '#7BBEFF', - 70: '#99CDFF', - 60: '#ACD6FF', - 50: '#C2E1FF', - 40: '#D5EAFF', - 30: '#E4F2FF', - 20: '#EFF7FF', - 10: '#F5FAFF' - }, - [COLOR_NAME.AQUA]: { - 100: '#004A63', - 90: '#005B79', - 80: '#00769D', - 70: '#0395C6', - 60: '#16B0E3', - 50: '#53CEF8', - 40: '#6DD0F1', - 30: '#9DE7FF', - 20: '#D0F3FF', - 10: '#E8F9FF' - }, - [COLOR_NAME.STEEL_GRAY]: { - 100: '#1F2436', - 90: '#2D344E', - 80: '#363E5A', - 70: '#414B6C', - 60: '#505B82', - 50: '#6976A4', - 40: '#7A89BB', - 30: '#8E9FD7', - 20: '#AFBDEB', - 10: '#CCD6F9' - }, - [COLOR_NAME.DARK_BLUE]: { - 100: '#10121A', - 90: '#161925', - 80: '#1C2031', - 70: '#212843', - 60: '#293256', - 50: '#23326A', - 40: '#263A83', - 30: '#2F4597', - 20: '#354FAF', - 10: '#3C5ACA' - }, - [COLOR_NAME.NEUTRAL]: { - 100: '#000000', - 90: '#131313', - 80: '#1D1D1D', - 70: '#3C3C3C', - 60: '#565656', - 50: '#717070', - 40: '#949494', - 30: '#CDCDCD', - 20: '#F3F3F3', - 10: '#FFFFFF' - }, - [COLOR_NAME.GREEN]: { - 100: '#033C21', - 90: '#064628', - 80: '#0B5633', - 70: '#1A6C46', - 60: '#2C845B', - 50: '#46A277', - 40: '#41C587', - 30: '#47E89D', - 20: '#65FFB7', - 10: '#ABFFD8' - }, - [COLOR_NAME.RED]: { - 100: '#5C0026', - 90: '#7B0435', - 80: '#9E104A', - 70: '#C62C6B', - 60: '#EA4588', - 50: '#FF64A3', - 40: '#FF89B9', - 30: '#FFA4C9', - 20: '#FFC4DC', - 10: '#FFF7FA' - }, - [COLOR_NAME.PEACH]: { - 100: '#B41313', - 90: '#CA3838', - 80: '#E75B5B', - 70: '#EA7878', - 60: '#FF9898', - 50: '#FFB1B1', - 40: '#FFCACA', - 30: '#FFDDDD', - 20: '#FFEBEB', - 10: '#FFFAFA' - }, - [COLOR_NAME.YELLOW]: { - 100: '#403E00', - 90: '#524F00', - 80: '#807B00', - 70: '#A8A200', - 60: '#CCC503', - 50: '#E9E339', - 40: '#FCF76D', - 30: '#F8F598', - 20: '#FFFDCA', - 10: '#FFFEEE' - }, - [COLOR_NAME.PURPLE]: { - 100: '#3D019C', - 90: '#510EBB', - 80: '#692FC7', - 70: '#8E5CDE', - 60: '#A775F8', - 50: '#BE96FF', - 40: '#D5BBFF', - 30: '#E1CFFF', - 20: '#EEE3FF', - 10: '#F4EDFF' - }, - [COLOR_NAME.ORANGE]: { - 100: '#4D2200', - 90: '#793600', - 80: '#A64B00', - 70: '#D25F00', - 60: '#F17400', - 50: '#FF8A29', - 40: '#FFA053', - 30: '#FFB77C', - 20: '#FFCDA6', - 10: '#FFE8D7' - } + [COLOR_NAME.LIGHT_BLUE]: { + 100: '#298EF1', + 90: '#52A6F8', + 80: '#7BBEFF', + 70: '#99CDFF', + 60: '#ACD6FF', + 50: '#C2E1FF', + 40: '#D5EAFF', + 30: '#E4F2FF', + 20: '#EFF7FF', + 10: '#F5FAFF', + }, + [COLOR_NAME.AQUA]: { + 100: '#004A63', + 90: '#005B79', + 80: '#00769D', + 70: '#0395C6', + 60: '#16B0E3', + 50: '#53CEF8', + 40: '#6DD0F1', + 30: '#9DE7FF', + 20: '#D0F3FF', + 10: '#E8F9FF', + }, + [COLOR_NAME.STEEL_GRAY]: { + 100: '#1F2436', + 90: '#2D344E', + 80: '#363E5A', + 70: '#414B6C', + 60: '#505B82', + 50: '#6976A4', + 40: '#7A89BB', + 30: '#8E9FD7', + 20: '#AFBDEB', + 10: '#CCD6F9', + }, + [COLOR_NAME.DARK_BLUE]: { + 100: '#10121A', + 90: '#161925', + 80: '#1C2031', + 70: '#212843', + 60: '#293256', + 50: '#23326A', + 40: '#263A83', + 30: '#2F4597', + 20: '#354FAF', + 10: '#3C5ACA', + }, + [COLOR_NAME.NEUTRAL]: { + 100: '#000000', + 90: '#131313', + 80: '#1D1D1D', + 70: '#3C3C3C', + 60: '#565656', + 50: '#717070', + 40: '#949494', + 30: '#CDCDCD', + 20: '#F3F3F3', + 10: '#FFFFFF', + }, + [COLOR_NAME.GREEN]: { + 100: '#033C21', + 90: '#064628', + 80: '#0B5633', + 70: '#1A6C46', + 60: '#2C845B', + 50: '#46A277', + 40: '#41C587', + 30: '#47E89D', + 20: '#65FFB7', + 10: '#ABFFD8', + }, + [COLOR_NAME.RED]: { + 100: '#5C0026', + 90: '#7B0435', + 80: '#9E104A', + 70: '#C62C6B', + 60: '#EA4588', + 50: '#FF64A3', + 40: '#FF89B9', + 30: '#FFA4C9', + 20: '#FFC4DC', + 10: '#FFF7FA', + }, + [COLOR_NAME.PEACH]: { + 100: '#B41313', + 90: '#CA3838', + 80: '#E75B5B', + 70: '#EA7878', + 60: '#FF9898', + 50: '#FFB1B1', + 40: '#FFCACA', + 30: '#FFDDDD', + 20: '#FFEBEB', + 10: '#FFFAFA', + }, + [COLOR_NAME.YELLOW]: { + 100: '#403E00', + 90: '#524F00', + 80: '#807B00', + 70: '#A8A200', + 60: '#CCC503', + 50: '#E9E339', + 40: '#FCF76D', + 30: '#F8F598', + 20: '#FFFDCA', + 10: '#FFFEEE', + }, + [COLOR_NAME.PURPLE]: { + 100: '#3D019C', + 90: '#510EBB', + 80: '#692FC7', + 70: '#8E5CDE', + 60: '#A775F8', + 50: '#BE96FF', + 40: '#D5BBFF', + 30: '#E1CFFF', + 20: '#EEE3FF', + 10: '#F4EDFF', + }, + [COLOR_NAME.ORANGE]: { + 100: '#4D2200', + 90: '#793600', + 80: '#A64B00', + 70: '#D25F00', + 60: '#F17400', + 50: '#FF8A29', + 40: '#FFA053', + 30: '#FFB77C', + 20: '#FFCDA6', + 10: '#FFE8D7', + }, } diff --git a/apps/frontend/src/core/theme/index.ts b/apps/frontend/src/core/theme/index.ts index db286ea..f8f796b 100644 --- a/apps/frontend/src/core/theme/index.ts +++ b/apps/frontend/src/core/theme/index.ts @@ -1,280 +1,279 @@ import { darkScrollbar } from '@mui/material' import { createTheme } from '@mui/material/styles' -import { fontSize, fontWeight } from '@mui/system' import CustomBit from '../../public/fonts/CustomBit.woff' import { COLORS } from './colors' const theme = createTheme({ - palette: { - mode: 'dark', - primary: { - light: '', - main: COLORS.LIGHT_BLUE[90], - dark: '' - }, - secondary: { - light: '', - main: COLORS.STEEL_GRAY[80], - dark: '' - }, - background: { - default: COLORS.DARK_BLUE[100], - paper: COLORS.DARK_BLUE[100] - }, - text: { - primary: COLORS.LIGHT_BLUE[10], - secondary: COLORS.STEEL_GRAY[40] - } - }, - typography: { - fontFamily: ['Poppins', 'sans-serif'].join(','), - fontSize: 14 - }, - components: { - MuiSelect: { - styleOverrides: { - select: { - padding: '0.9rem, 1.2rem', - fontSize: '0.9rem', - '&:before': { - border: 'none' - }, - '&:focus': { - background: 'transparent' - } - } - } - }, - MuiPopover: { - styleOverrides: { - paper: { - backgroundImage: 'none' + palette: { + mode: 'dark', + primary: { + light: '', + main: COLORS.LIGHT_BLUE[90], + dark: '', + }, + secondary: { + light: '', + main: COLORS.STEEL_GRAY[80], + dark: '', + }, + background: { + default: COLORS.DARK_BLUE[100], + paper: COLORS.DARK_BLUE[100], + }, + text: { + primary: COLORS.LIGHT_BLUE[10], + secondary: COLORS.STEEL_GRAY[40], }, - root: { - fontSize: '14px' - } - } - }, - MuiAccordion: { - styleOverrides: { - root: { - "&.MuiPaper-root": { - borderRadius: "32px", - }, - padding: '10px 10px 10px 20px', - background: COLORS.LIGHT_BLUE[50] - } - } }, - MuiFormControl: { - styleOverrides: { - root: { - width: '100%' - } - } + typography: { + fontFamily: ['Poppins', 'sans-serif'].join(','), + fontSize: 14, }, - MuiButton: { - styleOverrides: { - outlined: { - background: 'transparent', - fontWeight: 700, - borderRadius: '26px', - textTransform: 'none', - color: COLORS.LIGHT_BLUE[10], - padding: '16px 24px 16px 24px', + components: { + MuiSelect: { + styleOverrides: { + select: { + padding: '0.9rem, 1.2rem', + fontSize: '0.9rem', + '&:before': { + border: 'none', + }, + '&:focus': { + background: 'transparent', + }, + }, + }, }, - containedPrimary: { - fontWeight: 700, - borderRadius: '26px', - background: COLORS.LIGHT_BLUE[90], - color: COLORS.LIGHT_BLUE[10], - padding: '16px 24px 16px 24px', - textTransform: 'none', - '&:hover': { - background: COLORS.LIGHT_BLUE[80] - }, - '&:click': { - background: COLORS.LIGHT_BLUE[70] - }, - '&:disabled': { - background: COLORS.STEEL_GRAY[90], - color: COLORS.STEEL_GRAY[50] - } + MuiPopover: { + styleOverrides: { + paper: { + backgroundImage: 'none', + }, + root: { + fontSize: '14px', + }, + }, }, - containedSecondary: { - borderRadius: '26px', - background: COLORS.STEEL_GRAY[90], - color: COLORS.LIGHT_BLUE[10], - padding: '16px 24px 16px 24px', - textTransform: 'none', - '&:hover': { - background: COLORS.STEEL_GRAY[90] - }, - '&:click': { - background: COLORS.STEEL_GRAY[70] - }, - '&:disabled': { - color: COLORS.STEEL_GRAY[50] - } + MuiAccordion: { + styleOverrides: { + root: { + '&.MuiPaper-root': { + borderRadius: '32px', + }, + padding: '10px 10px 10px 20px', + background: COLORS.LIGHT_BLUE[50], + }, + }, }, - textPrimary: { - color: COLORS.LIGHT_BLUE[10], - fontWeight: 700, - textTransform: 'none', - '&:hover': { - textDecoration: 'underline 2px', - background: 'none' - } - } - } - }, - MuiInput: { - styleOverrides: { - input: { - '&::placeholder': { - textOverflow: 'ellipsis !important', - color: COLORS.STEEL_GRAY[20], - opacity: 1, - fontSize: '14px', - fontWeight: 600 - } + MuiFormControl: { + styleOverrides: { + root: { + width: '100%', + }, + }, }, - root: { - '& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button': + MuiButton: { + styleOverrides: { + outlined: { + background: 'transparent', + fontWeight: 700, + borderRadius: '26px', + textTransform: 'none', + color: COLORS.LIGHT_BLUE[10], + padding: '16px 24px 16px 24px', + }, + containedPrimary: { + fontWeight: 700, + borderRadius: '26px', + background: COLORS.LIGHT_BLUE[90], + color: COLORS.LIGHT_BLUE[10], + padding: '16px 24px 16px 24px', + textTransform: 'none', + '&:hover': { + background: COLORS.LIGHT_BLUE[80], + }, + '&:click': { + background: COLORS.LIGHT_BLUE[70], + }, + '&:disabled': { + background: COLORS.STEEL_GRAY[90], + color: COLORS.STEEL_GRAY[50], + }, + }, + containedSecondary: { + borderRadius: '26px', + background: COLORS.STEEL_GRAY[90], + color: COLORS.LIGHT_BLUE[10], + padding: '16px 24px 16px 24px', + textTransform: 'none', + '&:hover': { + background: COLORS.STEEL_GRAY[90], + }, + '&:click': { + background: COLORS.STEEL_GRAY[70], + }, + '&:disabled': { + color: COLORS.STEEL_GRAY[50], + }, + }, + textPrimary: { + color: COLORS.LIGHT_BLUE[10], + fontWeight: 700, + textTransform: 'none', + '&:hover': { + textDecoration: 'underline 2px', + background: 'none', + }, + }, + }, + }, + MuiInput: { + styleOverrides: { + input: { + '&::placeholder': { + textOverflow: 'ellipsis !important', + color: COLORS.STEEL_GRAY[20], + opacity: 1, + fontSize: '14px', + fontWeight: 600, + }, + }, + root: { + '& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button': { - display: 'none' + display: 'none', }, - '& input:-internal-autofill-selected': + '& input:-internal-autofill-selected': { - WebkitBoxShadow: '0 0 0 30px rgb(40, 49, 78) inset !important', - WebkitTextFillColor: 'white !important', - caretColor: 'white !important' - }, - '& input[type=number]': { - MozAppearance: 'textfield' + WebkitBoxShadow: '0 0 0 30px rgb(40, 49, 78) inset !important', + WebkitTextFillColor: 'white !important', + caretColor: 'white !important', }, - } - } - }, - MuiCssBaseline: { - styleOverrides: { - 'body': { - overflowY: 'scroll', + '& input[type=number]': { + MozAppearance: 'textfield', + }, + }, + }, }, - 'body::-webkit-scrollbar': { - width: '4px', - backgroundColor: 'transparent', + MuiCssBaseline: { + styleOverrides: { + 'body': { + overflowY: 'scroll', + }, + 'body::-webkit-scrollbar': { + width: '4px', + backgroundColor: 'transparent', + }, + 'body::-webkit-scrollbar-thumb': { + borderRadius: '2px', + backgroundColor: 'transparent', + }, + html: { + ...darkScrollbar({ + track: 'transparent', + thumb: COLORS.STEEL_GRAY[40], + active: 'transparent', + }), + '*::-webkit-scrollbar': { + width: '4px', + }, + '*::-webkit-scrollbar-thumb': { + background: COLORS.STEEL_GRAY[40], + borderRadius: '2px', + }, + }, + '@font-face': { + fontFamily: 'CudosBit', + fontStyle: 'normal', + fontDisplay: 'swap', + fontWeight: 400, + src: `url(${CustomBit}) format('woff')`, + unicodeRange: 'U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF', + }, + }, }, - 'body::-webkit-scrollbar-thumb': { - borderRadius: '2px', - backgroundColor: 'transparent', + MuiTooltip: { + styleOverrides: { + tooltip: { + minWidth: 'max-content', + }, + }, }, - html: { - ...darkScrollbar({ - track: 'transparent', - thumb: COLORS.STEEL_GRAY[40], - active: 'transparent' - }), - '*::-webkit-scrollbar': { - width: '4px' - }, - '*::-webkit-scrollbar-thumb': { - background: COLORS.STEEL_GRAY[40], - borderRadius: '2px' - } + MuiTable: { + styleOverrides: { + root: { + background: COLORS.STEEL_GRAY[100], + boxShadow: 'none', + borderRadius: '5px', + borderCollapse: 'collapse', + overflow: 'hidden', + }, + }, + }, + MuiTableBody: { + styleOverrides: { + root: { + border: 'none', + background: 'transparent', + }, + }, + }, + MuiTableHead: { + styleOverrides: { + root: { + background: COLORS.STEEL_GRAY[90], + color: COLORS.STEEL_GRAY[40], + }, + }, + }, + MuiTableCell: { + styleOverrides: { + root: { + border: 'none', + background: 'transparent', + backgroundColor: 'transparent', + }, + }, + }, + MuiTabs: { + styleOverrides: { + root: { + background: COLORS.STEEL_GRAY[90], + borderRadius: '30px', + minHeight: '34px', + height: '34px', + }, + indicator: { + display: 'none', + }, + }, + }, + MuiTab: { + styleOverrides: { + root: { + background: COLORS.STEEL_GRAY[90], + borderRadius: '30px', + fontSize: '12px', + fontWeight: 600, + minHeight: '34px', + height: '34px', + textTransform: 'capitalize', + '&.Mui-selected': { + background: COLORS.LIGHT_BLUE[90], + transition: 'background .3s ease-in-out', + }, + }, + }, }, - '@font-face': { - fontFamily: 'CudosBit', - fontStyle: 'normal', - fontDisplay: 'swap', - fontWeight: 400, - src: `url(${CustomBit}) format('woff')`, - unicodeRange: "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF" - } - } - }, - MuiTooltip: { - styleOverrides: { - tooltip: { - minWidth: 'max-content', - } - } - }, - MuiTable: { - styleOverrides: { - root: { - background: COLORS.STEEL_GRAY[100], - boxShadow: 'none', - borderRadius: '5px', - borderCollapse: 'collapse', - overflow: 'hidden' - } - } - }, - MuiTableBody: { - styleOverrides: { - root: { - border: 'none', - background: 'transparent' - } - } - }, - MuiTableHead: { - styleOverrides: { - root: { - background: COLORS.STEEL_GRAY[90], - color: COLORS.STEEL_GRAY[40] - } - } - }, - MuiTableCell: { - styleOverrides: { - root: { - border: 'none', - background: 'transparent', - backgroundColor: 'transparent' - } - } }, - MuiTabs: { - styleOverrides: { - root: { - background: COLORS.STEEL_GRAY[90], - borderRadius: '30px', - minHeight: '34px', - height: '34px' + custom: { + backgrounds: { + light: COLORS.STEEL_GRAY[90], + primary: COLORS.STEEL_GRAY[100], + dark: COLORS.DARK_BLUE[100], }, - indicator: { - display: 'none' - } - } }, - MuiTab: { - styleOverrides: { - root: { - background: COLORS.STEEL_GRAY[90], - borderRadius: '30px', - fontSize: '12px', - fontWeight: 600, - minHeight: '34px', - height: '34px', - textTransform: 'capitalize', - '&.Mui-selected': { - background: COLORS.LIGHT_BLUE[90], - transition: 'background .3s ease-in-out' - } - } - } - } - }, - custom: { - backgrounds: { - light: COLORS.STEEL_GRAY[90], - primary: COLORS.STEEL_GRAY[100], - dark: COLORS.DARK_BLUE[100] - } - } }) export default theme diff --git a/apps/frontend/src/core/theme/themeStyles.ts b/apps/frontend/src/core/theme/themeStyles.ts index 5ef2073..60234f1 100644 --- a/apps/frontend/src/core/theme/themeStyles.ts +++ b/apps/frontend/src/core/theme/themeStyles.ts @@ -1,4 +1,4 @@ -import { COLORS } from "./colors"; +import { COLORS } from './colors'; export const themeStyles = { logoHolder: { @@ -6,22 +6,22 @@ export const themeStyles = { height: '24px', display: 'flex', justifyContent: 'center', - alignItems: 'center' + alignItems: 'center', }, centerFlexLinear: { alignItems: 'center', display: 'flex', - justifyContent: 'center' + justifyContent: 'center', }, centerFlexColumn: { alignItems: 'center', display: 'flex', justifyContent: 'center', - flexDirection: 'column' + flexDirection: 'column', }, icons: { marginLeft: '10px', - cursor: 'pointer' + cursor: 'pointer', }, iconHolder: { display: 'flex', @@ -32,11 +32,11 @@ export const themeStyles = { padding: '12px', borderRadius: '50%', background: COLORS.STEEL_GRAY[90], - "&:hover": { - background: COLORS.STEEL_GRAY[80] + '&:hover': { + background: COLORS.STEEL_GRAY[80], }, '&:click': { - background: COLORS.STEEL_GRAY[70] - } - } + background: COLORS.STEEL_GRAY[70], + }, + }, } diff --git a/apps/frontend/src/core/utilities/CustomHooks/useManipulateAllowlist.tsx b/apps/frontend/src/core/utilities/CustomHooks/useManipulateAllowlist.tsx index 36e7bac..46ece61 100644 --- a/apps/frontend/src/core/utilities/CustomHooks/useManipulateAllowlist.tsx +++ b/apps/frontend/src/core/utilities/CustomHooks/useManipulateAllowlist.tsx @@ -12,6 +12,7 @@ import { JOIN_ALLOWLIST, UPDATE_ALLOWLIST } from "../../api/calls"; +import { blobToBase64 } from "../../../features/allowlists/presentation/components/helpers"; const useManipulateAllowlist = () => { @@ -113,6 +114,9 @@ const useManipulateAllowlist = () => { const createAllowlist = useCallback(async (collectedData: CollectedData): Promise<{ success: boolean, message: string }> => { + const image = await blobToBase64(collectedData.image) + const banner_image = await blobToBase64(collectedData.banner_image) + const data = { name: collectedData.name, url: collectedData.url, @@ -128,8 +132,8 @@ const useManipulateAllowlist = () => { discord_invite_link: collectedData.discord_server, server_role: collectedData.server_role, require_email: collectedData.require_email, - image: collectedData.image, - banner_image: collectedData.banner_image + image: image, + banner_image: banner_image }; try { diff --git a/apps/frontend/src/features/allowlists/presentation/components/helpers.tsx b/apps/frontend/src/features/allowlists/presentation/components/helpers.tsx index a25fd8a..40cfd42 100644 --- a/apps/frontend/src/features/allowlists/presentation/components/helpers.tsx +++ b/apps/frontend/src/features/allowlists/presentation/components/helpers.tsx @@ -15,21 +15,11 @@ import { getTimeFromNumber } from "../../../../core/utilities/ProjectUtils"; import { LinkBox } from "../../../../core/theme/helpers"; import { updateModalState } from "../../../../core/store/modals"; import ClipLoader from "react-spinners/ClipLoader"; +import { SocialMediaAction } from "../../../../core/store/socialMediaActions"; import { headerStyles } from "../../../../core/presentation/components/Layout/styles"; import { allowlistPreviewStyles, allowListStyles, menuStyles } from "./styles"; -export enum SocialMediaAction { - joinDiscordServer = 'joinDiscordServer', - followTwitterAccount = 'followTwitterAccount', - likeTweet = 'likeTweet', - retweetTweet = 'retweetTweet' -} - -export type SocialMediaUserActions = { - [key in SocialMediaAction]: boolean -} - export enum FormFieldErrors { connectWalletToSetChainId = 'Connect your Wallet to set a Chain ID', description = 'Have to be between 20 and 1000 characters', diff --git a/apps/frontend/src/features/allowlists/presentation/pages/styles.ts b/apps/frontend/src/features/allowlists/presentation/pages/styles.ts index 770e70c..3ed2a9b 100644 --- a/apps/frontend/src/features/allowlists/presentation/pages/styles.ts +++ b/apps/frontend/src/features/allowlists/presentation/pages/styles.ts @@ -1,41 +1,41 @@ -import { COLORS } from "../../../../core/theme/colors" +import { COLORS } from '../../../../core/theme/colors' export const createAllowlistStyles = { holder: { alignItems: 'center', width: '100%', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, contentHolder: { display: 'flex', flexDirection: 'column', padding: '3rem 4rem 8rem 4rem', - maxWidth: '900px' + maxWidth: '900px', }, } export const generalStyles = { noJoinedTitle: { alignSelf: 'flex-start', - color: COLORS.LIGHT_BLUE[10] + color: COLORS.LIGHT_BLUE[10], }, noJoinedSubtitle: { marginTop: '15%', alignSelf: 'center', textAlign: 'center', - color: COLORS.LIGHT_BLUE[10] + color: COLORS.LIGHT_BLUE[10], }, noJoinedHolder: { display: 'flex', width: '100%', - flexDirection: 'column' + flexDirection: 'column', }, noJoinedBtn: { margin: '35px 0px 10% 0px', alignSelf: 'center', width: '192px', - height: '48px' + height: '48px', }, dashboardMenu: { marginTop: '-10px', @@ -44,7 +44,7 @@ export const generalStyles = { minWidth: 'max-content', maxWidth: '270px', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, dasboardMenuItem: (menuSwitchingTimeout: number) => { return { @@ -52,27 +52,27 @@ export const generalStyles = { padding: '18px 16px', borderRadius: '8px', transition: `background-color 0.${menuSwitchingTimeout * 2}s`, - backgroundColor: 'transparent' + backgroundColor: 'transparent', } }, arrowIconHolder: { position: 'relative', display: 'flex', - alignItems: 'center' + alignItems: 'center', }, rotatingArrow: { - position: 'absolute' as 'absolute', - transition: "transform 0.2s ease-in-out", + position: 'absolute' as const, + transition: 'transform 0.2s ease-in-out', height: '20px', width: '20px', - color: COLORS.LIGHT_BLUE[90] + color: COLORS.LIGHT_BLUE[90], }, collapsebleTextHolder: { justifyContent: 'flex-start', marginBottom: '-10px', cursor: 'pointer', alignItems: 'center', - display: 'flex' + display: 'flex', }, plusIconBackground: { background: COLORS.LIGHT_BLUE[90], @@ -81,31 +81,31 @@ export const generalStyles = { height: '48px', padding: '12px', display: 'flex', - alignItems: 'center' + alignItems: 'center', }, clocIcon: { width: '24px', height: '24px', marginRight: '10px', - color: COLORS.STEEL_GRAY[20] + color: COLORS.STEEL_GRAY[20], }, avatar: { - transform: "translateY(-70%)", + transform: 'translateY(-70%)', backdropFilter: 'blur(16px)', - border: "2px solid #F5FAFF", + border: '2px solid #F5FAFF', borderRadius: '16px', padding: '5px', - minWidth: "128px", - minHeight: "128px", - width: "128px", - height: "128px", - objectFit: "fill" as 'fill' + minWidth: '128px', + minHeight: '128px', + width: '128px', + height: '128px', + objectFit: 'fill' as const, }, banner: { borderRadius: '12px', - width: "100%", - minHeight: "210px", - objectFit: "cover" as 'cover' + width: '100%', + minHeight: '210px', + objectFit: 'cover' as const, }, imgHolder: { width: '100%', @@ -113,31 +113,31 @@ export const generalStyles = { flexDirection: 'column', display: 'flex', height: '270px', - alignItems: 'center' + alignItems: 'center', }, gridsHolder: { width: '100%', padding: '4rem 4rem 6rem 4rem', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, dashboardHolder: { width: '100%', padding: '4rem 4rem 6rem 4rem', - display: 'flex' + display: 'flex', }, createBox: { - "&:hover": { - transform: 'scale(1.025)' + '&:hover': { + transform: 'scale(1.025)', }, - transition: "transform 0.5s ease, top 0.5s ease", + transition: 'transform 0.5s ease, top 0.5s ease', textAlign: 'center', padding: '16px 16px 24px 16px', cursor: 'pointer', justifyContent: 'center', marginLeft: '5px', background: 'transparent', - border: "1px dashed #363E5A", + border: '1px dashed #363E5A', alignItems: 'center', display: 'flex', flexDirection: 'column', @@ -145,11 +145,11 @@ export const generalStyles = { borderRadius: '16px', }, gridDataBox: { - "&:hover": { - transform: 'scale(1.025)' + '&:hover': { + transform: 'scale(1.025)', }, justifyContent: 'center', - transition: "transform 0.5s ease, top 0.5s ease", + transition: 'transform 0.5s ease, top 0.5s ease', cursor: 'pointer', alignItems: 'center', display: 'flex', @@ -157,11 +157,11 @@ export const generalStyles = { padding: '16px 16px 24px 16px', height: '360px', borderRadius: '16px', - background: COLORS.STEEL_GRAY[100] + background: COLORS.STEEL_GRAY[100], }, spinner: { marginTop: '40vh', display: 'flex', alignSelf: 'center', - } + }, } diff --git a/apps/frontend/src/features/app-routes/entities/AppRoutes.ts b/apps/frontend/src/features/app-routes/entities/AppRoutes.ts index 12bc746..8bb76b8 100644 --- a/apps/frontend/src/features/app-routes/entities/AppRoutes.ts +++ b/apps/frontend/src/features/app-routes/entities/AppRoutes.ts @@ -1,9 +1,9 @@ export default class AppRoutes { - static MAIN = '/'; - static NOT_FOUND = '/not-found'; - static CREATE_ALLOWLIST = '/create'; - static EDIT_ALLOWLIST = '/edit/:id'; - static ALLOWLIST = '/allowlist/:id'; - static ALLOWLISTS = '/allowlists'; - static DASHBOARD = '/dashboard'; + static MAIN = '/'; + static NOT_FOUND = '/not-found'; + static CREATE_ALLOWLIST = '/create'; + static EDIT_ALLOWLIST = '/edit/:id'; + static ALLOWLIST = '/allowlist/:id'; + static ALLOWLISTS = '/allowlists'; + static DASHBOARD = '/dashboard'; } diff --git a/apps/frontend/src/features/app-routes/presentation/components/Home/styles.ts b/apps/frontend/src/features/app-routes/presentation/components/Home/styles.ts index f73f244..5997f2d 100644 --- a/apps/frontend/src/features/app-routes/presentation/components/Home/styles.ts +++ b/apps/frontend/src/features/app-routes/presentation/components/Home/styles.ts @@ -1,32 +1,32 @@ -import { COLORS } from "../../../../../core/theme/colors" +import { COLORS } from '../../../../../core/theme/colors' export const forCollectorsStyles = { avatar: { padding: '10px 10px 0px 10px', borderRadius: '8px', - border: "1px solid #F5FAFF", + border: '1px solid #F5FAFF', position: 'absolute', top: -5, right: 55, backdropFilter: 'blur(16px)', background: 'gba(16, 18, 26, 0.8)', height: '164px', - width: '164px' + width: '164px', }, yellowBox: { borderRadius: '8px', - border: "1px solid #F5FAFF", + border: '1px solid #F5FAFF', position: 'absolute', top: 20, right: 30, background: 'rgba(218, 251, 51, 1)', height: '164px', - width: '164px' + width: '164px', }, leftContent: { position: 'relative', width: '490px', - height: '480px' + height: '480px', }, holder: { marginBottom: '4rem', @@ -38,13 +38,13 @@ export const forCollectorsStyles = { textHolder: { flexDirection: 'column', display: 'flex', - width: '551px' + width: '551px', }, btn: { marginTop: '3rem', width: '192px', height: '56px', - borderRadius: '100px' + borderRadius: '100px', }, rightContent: { justifyContent: 'space-between', @@ -55,19 +55,19 @@ export const forCollectorsStyles = { export const forCreatorsStyles = { avatar: { - position: 'absolute' as 'absolute', + position: 'absolute' as const, top: -5, right: 55, }, avatarBack: { - position: 'absolute' as 'absolute', + position: 'absolute' as const, top: 20, right: 60, }, rightContent: { position: 'relative', width: '490px', - height: '480px' + height: '480px', }, holder: { marginBottom: '4rem', @@ -79,13 +79,13 @@ export const forCreatorsStyles = { textHolder: { flexDirection: 'column', display: 'flex', - width: '551px' + width: '551px', }, btn: { marginTop: '3rem', width: '192px', height: '56px', - borderRadius: '100px' + borderRadius: '100px', }, leftContent: { justifyContent: 'space-between', @@ -96,14 +96,14 @@ export const forCreatorsStyles = { export const homeStyles = { mainCardAndFeadturesHolder: { margin: '0rem 4rem', - maxWidth: '1600px' + maxWidth: '1600px', }, holder: { alignItems: 'center', width: '100%', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, } @@ -115,28 +115,28 @@ export const lowerSectionStyles = { width: '100%', height: 'max-content', borderRadius: '64px 64px 0px 0px', - background: 'linear-gradient(135deg, #10121A 0%, #1D243F 100%)' - } + background: 'linear-gradient(135deg, #10121A 0%, #1D243F 100%)', + }, } export const mainCardStyles = { textHolder: { flexDirection: 'column', display: 'flex', - width: '551px' + width: '551px', }, avatar: { width: '128px', marginLeft: '-64px', - position: 'absolute' as 'absolute', + position: 'absolute' as const, left: '50%', - bottom: -60 + bottom: -60, }, svgHolder: { position: 'relative', flexDirection: 'column', display: 'flex', - height: '288px' + height: '288px', }, rightContent: { justifyContent: 'space-between', @@ -158,11 +158,11 @@ export const mainCardStyles = { alignItems: 'center', display: 'flex', justifyContent: 'space-between', - padding: "115px 111px", + padding: '115px 111px', borderRadius: '24px', width: '100%', - background: 'linear-gradient(135deg, #10121A 0%, #2F4597 100%)' - } + background: 'linear-gradient(135deg, #10121A 0%, #2F4597 100%)', + }, } export const featuresStyle = { @@ -173,37 +173,37 @@ export const featuresStyle = { textAlign: 'center', display: 'flex', flexDirection: 'column', - alignItems: 'flex-start' + alignItems: 'flex-start', }, gridHolder: { display: 'flex', - justifyContent: "space-around", + justifyContent: 'space-around', alignItems: 'center', - height: "100%" + height: '100%', }, } export const FAQStyle = { expandIcon: { color: COLORS.LIGHT_BLUE[90], - height: '22px' + height: '22px', }, containerBox: { maxWidth: '1024px', textAlign: 'center', display: 'flex', flexDirection: 'column', - alignItems: 'center' + alignItems: 'center', }, FaqItemHolder: { width: '100%', display: 'flex', borderRadius: '32px', justifyContent: 'center', - alignItems: 'center' + alignItems: 'center', }, accordion: { borderRadius: '32px', - background: COLORS.DARK_BLUE[50] + background: COLORS.DARK_BLUE[50], }, -} \ No newline at end of file +} diff --git a/apps/frontend/src/types/custom.d.ts b/apps/frontend/src/types/custom.d.ts index f30fbb5..c393b87 100644 --- a/apps/frontend/src/types/custom.d.ts +++ b/apps/frontend/src/types/custom.d.ts @@ -6,12 +6,12 @@ declare module '*.svg' { export default src; } -declare module "*.png" { +declare module '*.png' { const value: any; export default value; } -declare module "*.jpeg" { +declare module '*.jpeg' { const value: any; export default value; } diff --git a/apps/frontend/src/types/fonts.d.ts b/apps/frontend/src/types/fonts.d.ts index 5f57ac7..3e68fa4 100644 --- a/apps/frontend/src/types/fonts.d.ts +++ b/apps/frontend/src/types/fonts.d.ts @@ -1 +1 @@ -declare module '*.woff' \ No newline at end of file +declare module '*.woff'