Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
"typescript.tsdk": "node_modules/typescript/lib"
}
10 changes: 5 additions & 5 deletions cdk/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
testEnvironment: 'node',
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
testEnvironment: "node",
roots: ["<rootDir>/test"],
testMatch: ["**/*.test.ts"],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
"^.+\\.tsx?$": "ts-jest",
},
};
2 changes: 1 addition & 1 deletion cdk/lambdas/imageResize.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports.handler = async (event) => {
Bucket: bucket,
Key: targetKey,
Body: resizedImage,
})
}),
);

return {
Expand Down
28 changes: 14 additions & 14 deletions cdk/lib/app-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class AppStack extends cdk.Stack {
const domainName = ssm.StringParameter.valueForStringParameter(
this,
`/env/domainName`,
1
1,
);

const wwwDomainName = `www.${domainName}`;
Expand All @@ -49,7 +49,7 @@ export class AppStack extends cdk.Stack {
effect: iam.Effect.ALLOW,
actions: ["s3:*Object", "SES:*"],
resources: ["*"],
})
}),
);

taskDef
Expand All @@ -65,36 +65,36 @@ export class AppStack extends cdk.Stack {
ssm.StringParameter.fromSecureStringParameterAttributes(
this,
"dbUrl",
{ parameterName: "/env/db/dbUrl", version: 1 }
)
{ parameterName: "/env/db/dbUrl", version: 1 },
),
),
GITHUB_SECRET: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"githubSecret",
"/env/githubSecret"
)
"/env/githubSecret",
),
),
GITHUB_ID: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"githubId",
"/env/githubId"
)
"/env/githubId",
),
),
NEXTAUTH_SECRET: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"nextauthSecret",
"/env/nextauthSecret"
)
"/env/nextauthSecret",
),
),
DISCORD_INVITE_URL: ecs.Secret.fromSsmParameter(
ssm.StringParameter.fromStringParameterName(
this,
"discordInviteUrl",
"/env/discordInviteUrl"
)
"/env/discordInviteUrl",
),
),
},
logging: ecs.LogDrivers.awsLogs({
Expand All @@ -115,7 +115,7 @@ export class AppStack extends cdk.Stack {
cpu: production ? 256 : 256, // Can alter if need more
publicLoadBalancer: true,
protocol: elbv2.ApplicationProtocol.HTTP,
}
},
);

fargateService.listener.addAction("DefaultListenerRule", {
Expand Down Expand Up @@ -158,7 +158,7 @@ export class AppStack extends cdk.Stack {

fargateService.service.connections.allowFromAnyIpv4(
ec2.Port.tcp(this.appPort),
"app-inbound"
"app-inbound",
);

this.loadbalancer = fargateService.loadBalancer;
Expand Down
18 changes: 9 additions & 9 deletions cdk/lib/cdn-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export class CdnStack extends cdk.Stack {
const domainName = ssm.StringParameter.valueForStringParameter(
this,
`/env/domainName`,
1
1,
);

const hostedZoneId = ssm.StringParameter.valueForStringParameter(
this,
`/env/hostedZoneId`,
1
1,
);

const wwwDomainName = `www.${domainName}`;
Expand Down Expand Up @@ -70,12 +70,12 @@ export class CdnStack extends cdk.Stack {
certificate,
{
aliases: [domainName],
}
},
),
comment: `Redirect to ${wwwDomainName} from ${domainName}`,
priceClass: cloudfront.PriceClass.PRICE_CLASS_ALL,
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
}
},
);

const webDistribution = new cloudfront.CloudFrontWebDistribution(
Expand Down Expand Up @@ -120,34 +120,34 @@ export class CdnStack extends cdk.Stack {
certificate,
{
aliases: [wwwDomainName],
}
},
),
comment: `Web distribution for ${wwwDomainName}`,
priceClass: cloudfront.PriceClass.PRICE_CLASS_ALL,
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
}
},
);

const redirectRecordProps = {
zone,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new targets.CloudFrontTarget(redirectDist)
new targets.CloudFrontTarget(redirectDist),
),
};

new route53.ARecord(this, "ARedirectAliasRecord", redirectRecordProps);
new route53.AaaaRecord(
this,
"AaaaRedirectAliasRecord",
redirectRecordProps
redirectRecordProps,
);

const recordProps = {
zone,
recordName: wwwDomainName,
target: route53.RecordTarget.fromAlias(
new targets.CloudFrontTarget(webDistribution)
new targets.CloudFrontTarget(webDistribution),
),
};

Expand Down
4 changes: 2 additions & 2 deletions cdk/lib/pipeline-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export class PipelineStack extends cdk.Stack {

const devAccountId = ssm.StringParameter.valueFromLookup(
this,
`/env/dev/accountId`
`/env/dev/accountId`,
);

const prodAccountId = ssm.StringParameter.valueFromLookup(
this,
`/env/prod/accountId`
`/env/prod/accountId`,
);

const defaultRegion = "eu-west-1";
Expand Down
12 changes: 6 additions & 6 deletions cdk/lib/storage-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class StorageStack extends cdk.Stack {
const bucketName = ssm.StringParameter.valueForStringParameter(
this,
"/env/bucketname",
1
1,
);

this.originAccessIdentity = new OriginAccessIdentity(this, "OAI", {
Expand Down Expand Up @@ -77,19 +77,19 @@ export class StorageStack extends cdk.Stack {
new S3EventSource(this.bucket, {
events: [s3.EventType.OBJECT_CREATED],
filters: [{ prefix: "u/" }],
})
}),
);

const dbUsername = ssm.StringParameter.valueForStringParameter(
this,
"/env/db/username",
1
1,
);

const dbName = ssm.StringParameter.valueForStringParameter(
this,
"/env/db/name",
1
1,
);

// RDS
Expand All @@ -101,15 +101,15 @@ export class StorageStack extends cdk.Stack {
}),
credentials: rds.Credentials.fromPassword(
dbUsername,
cdk.SecretValue.ssmSecure("/env/db/password", "1")
cdk.SecretValue.ssmSecure("/env/db/password", "1"),
),
vpc: vpc,
vpcSubnets: vpc.selectSubnets({
subnetType: ec2.SubnetType.PUBLIC,
}),
instanceType: ec2.InstanceType.of(
ec2.InstanceClass.T4G,
ec2.InstanceSize.MICRO
ec2.InstanceSize.MICRO,
),
allocatedStorage: 20,
maxAllocatedStorage: 100,
Expand Down
14 changes: 3 additions & 11 deletions cdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"jsx": "react",
"target": "ES2020",
"module": "commonjs",
"lib": [
"es2020", "dom"
],
"lib": ["es2020", "dom"],
"esModuleInterop": true,
"declaration": true,
"strict": true,
Expand All @@ -21,13 +19,7 @@
"inlineSources": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"typeRoots": [
"./node_modules/@types"
]
"typeRoots": ["./node_modules/@types"]
},
"exclude": [
"lambdas",
"node_modules",
"cdk.out"
]
"exclude": ["lambdas", "node_modules", "cdk.out"]
}
3 changes: 1 addition & 2 deletions components/ArticleSearch/SearchBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

interface Props {
searchTerm: string;
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
Expand All @@ -10,7 +9,7 @@ const SearchBar = (props: Props) => {
console.log(searchTerm);

return (
<div className='flex grow justify-end'>
<div className="flex grow justify-end">
<label htmlFor="searchInput" aria-label="Enter search term"></label>
<input
onChange={(e) => setSearchTerm(e.target.value)}
Expand Down
14 changes: 7 additions & 7 deletions components/Comments/CommentsArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
const onSubmit = async (
body: string,
parentId: number | undefined,
fieldName: FieldName
fieldName: FieldName,
) => {
// vaidate markdoc syntax
const ast = Markdoc.parse(body);
const errors = Markdoc.validate(ast, config).filter(
(e) => e.error.level === "critical"
(e) => e.error.level === "critical",
);

if (errors.length > 0) {
Expand Down Expand Up @@ -164,7 +164,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {

const generateComments = (
commentsArr: Comments | Children | undefined,
depth = 0
depth = 0,
) => {
if (!commentsArr) return null;
return commentsArr.map(
Expand Down Expand Up @@ -196,7 +196,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
year: "numeric",
month: "long",
day: "numeric",
}
},
);

const commentUpdated =
Expand Down Expand Up @@ -321,7 +321,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
// TODO: Add alert to confirm reset if there is already content being written
resetField("reply");
setShowCommentBoxId((currentId) =>
currentId === id ? null : id
currentId === id ? null : id,
);
}
}}
Expand Down Expand Up @@ -362,7 +362,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
)}
</section>
);
}
},
);
};

Expand Down Expand Up @@ -415,7 +415,7 @@ const CommentsArea = ({ postId, postOwnerId }: Props) => {
React,
{
components: markdocComponents,
}
},
)}
</article>
) : (
Expand Down
15 changes: 10 additions & 5 deletions components/Course/CoursePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ const CoursePreview = ({ name, description, thumbnail }: Props) => {
<Image alt={name} src={thumbnail} fill className="object-cover" />
</div>
<div className="order-2 md:order-1">
<h2 className="font-bold text-lg px-3 py-2 lg:px-6 lg:py-1 border-neutral-500 border-b">{name}</h2>
<div className="px-3 py-3 lg:px-6" dangerouslySetInnerHTML={{ __html: description }} />
<h2 className="font-bold text-lg px-3 py-2 lg:px-6 lg:py-1 border-neutral-500 border-b">
{name}
</h2>
<div
className="px-3 py-3 lg:px-6"
dangerouslySetInnerHTML={{ __html: description }}
/>
</div>
</div>
)
}
);
};

export default CoursePreview
export default CoursePreview;
Loading