Skip to content

Commit

Permalink
chore: refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
querwurzel committed Dec 16, 2024
1 parent e6f1a09 commit 866b125
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const App: Component = (props: ParentProps): JSX.Element => {

<main class={styles.left}>
<div class={styles.leftContainer}>
{props.children}
{props.children}
</div>
</main>

Expand Down
14 changes: 9 additions & 5 deletions frontend/src/AppContext.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import {PasteView} from './api/model/PasteView';
import {PasteClone} from './components/CreatePaste/CreatePaste';

export type PasteClone = {
title?: string
content: string
}

export interface IAppContext {
pushPasteCloned: (data: PasteClone) => void
Expand All @@ -24,9 +28,9 @@ class AppContextImpl implements IAppContext {
}

popPasteCloned() : PasteClone | undefined {
const holder = this.pasteCloned;
const ref = this.pasteCloned;
delete this.pasteCloned;
return holder;
return ref;
}

pushPasteCreated(paste: PasteView) {
Expand All @@ -35,9 +39,9 @@ class AppContextImpl implements IAppContext {
}

popPasteCreated() : PasteView | undefined {
const holder = this.pasteCreated;
const ref = this.pasteCreated;
delete this.pasteCreated;
return holder;
return ref;
}

onPasteCreated(callback: (paste: PasteView) => void) {
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/CreatePaste/CreatePaste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import {createStore} from "solid-js/store";
import {PasteCreateCmd} from "../../api/model/PasteCreateCmd";
import {encrypt} from "../../crypto/CryptoUtil";
import {CopyToClipboard} from "../../assets/Vectors";
import {PasteClone} from "../../src/AppContext";
import styles from "./createPaste.module.css";

export type PasteClone = {
title?: string
content: string
}

type CreatePasteProps = {
onCreatePaste: (paste: PasteCreateCmd) => Promise<void>
initialPaste?: PasteClone
Expand Down

0 comments on commit 866b125

Please sign in to comment.