Skip to content

Commit

Permalink
Merge branch 'main' into setup-login
Browse files Browse the repository at this point in the history
  • Loading branch information
devsargam authored Mar 11, 2024
2 parents a6c02ae + c029acf commit 5c01cdf
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: npm install --legacy-peer-deps

- name: Run linting check
run: npm run lint:fix
run: npm run lint:check

- name: Check formatting
run: npm run format:fix
5 changes: 2 additions & 3 deletions src/components/3dcard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export const CardBody = ({
};

export const CardItem = ({
as: Tag = 'div',
children,
className,
translateX = 0,
Expand Down Expand Up @@ -137,13 +136,13 @@ export const CardItem = ({
};

return (
<Tag
<div
ref={ref}
className={cn('w-fit transition duration-200 ease-linear', className)}
{...rest}
>
{children}
</Tag>
</div>
);
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function Sidebar({
}

return (
<div className="overflow-scroll h-full w-[300px] min-w-[133px] overflow-y-auto bg-gray-50 dark:bg-gray-800 cursor-pointer sticky top-[64px] self-start w-84">
<div className="overflow-y-scroll h-screen w-[300px] min-w-[133px] bg-gray-50 dark:bg-gray-800 cursor-pointer sticky top-[64px] self-start w-84">
<div className="flex">
{/* <ToggleButton
onClick={() => {
Expand Down
4 changes: 0 additions & 4 deletions src/components/admin/ContentRendererClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ export const ContentRendererClient = ({
)}
</div>
</div>
<br />
<br /> <br />
{nextContent ? (
<div className="flex flex-row-reverse">
<button
Expand All @@ -184,8 +182,6 @@ export const ContentRendererClient = ({
</button>{' '}
</div>
) : null}
<br /> <br />
<br /> <br />
</div>

{showChapters && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/comment/CommentInputForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const CommentInputForm = ({
<textarea
id="content"
name="content"
className="min-h-[50px] rounded-md dark:bg-gray-800 p-2"
className="min-h-[50px] border border-slate-350 rounded-md dark:bg-gray-800 p-2"
placeholder="Add a public comment..."
/>
<FormErrors id="content" errors={fieldErrors} />
Expand Down
22 changes: 12 additions & 10 deletions src/db/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Cache {
}
>();
}

static getInstance() {
if (!this.instance) {
this.instance = new Cache();
Expand All @@ -25,26 +26,27 @@ export class Cache {
return this.instance;
}

set(type: string, args: string[], value: any) {
set(type: string, args: string[], value: any, expirySeconds: number = parseInt(process.env.CACHE_EXPIRE_S || '100', 10)) {
this.inMemoryDb.set(`${type} ${JSON.stringify(args)}`, {
value,
expiry:
new Date().getTime() +
parseInt(process.env.CACHE_EXPIRE_S || '100', 10) * 1000,
expiry: new Date().getTime() + expirySeconds * 1000,
});
}

get(type: string, args: string[]) {
const value = this.inMemoryDb.get(`${type} ${JSON.stringify(args)}`);
if (!value) {
const key = `${type} ${JSON.stringify(args)}`;
const entry = this.inMemoryDb.get(key);
if (!entry) {
return null;
}
if (new Date().getTime() > value.expiry) {
this.inMemoryDb.delete(`${type} ${JSON.stringify(args)}`);
if (new Date().getTime() > entry.expiry) {
this.inMemoryDb.delete(key);
return null;
}
return value.value;
return entry.value;
}

evict() {}
evict() {

}
}
12 changes: 12 additions & 0 deletions src/utiles/jsx.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';

declare global {
namespace JSX {
interface IntrinsicElements {
[elemName: string]: React.DetailedHTMLProps<
React.HTMLAttributes<HTMLElement>,
HTMLElement
>;
}
}
}

0 comments on commit 5c01cdf

Please sign in to comment.