Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ae4650a
Update README.md
jaswch Dec 24, 2022
77a8a88
Update apps.store.ts
jaswch Dec 25, 2022
e89fed1
Update apps-config.ts
jaswch Dec 25, 2022
bde2d81
Update AppNexus.svelte
jaswch Dec 25, 2022
f9978d4
Create Notes.svelte
jaswch Dec 25, 2022
bfedc3e
Create count.svelte
jaswch Dec 25, 2022
58fcf90
Create stores.js
jaswch Dec 25, 2022
a7dbd7e
Update README.md
jaswch Dec 25, 2022
de3a3d4
Update apps-config.ts
jaswch Dec 25, 2022
1b07714
Delete count.svelte
jaswch Dec 27, 2022
8a0bd12
Update Notes.svelte
jaswch Dec 27, 2022
7cd7bf3
Update AppNexus.svelte
jaswch Dec 27, 2022
4d2e874
Update and rename stores.js to store.ts
jaswch Dec 28, 2022
a4ac47e
Update Notes.svelte
jaswch Dec 28, 2022
c4dad30
Delete 256.png
jaswch Dec 28, 2022
91580be
Add files via upload
jaswch Dec 28, 2022
d65ebfa
Update Notes.svelte
jaswch Dec 28, 2022
f68b6e5
Update Notes.svelte
jaswch Dec 30, 2022
19c2c20
Update Notes.svelte
jaswch Dec 30, 2022
7717cf5
Update Notes.svelte
jaswch Dec 30, 2022
845657c
Update Notes.svelte
jaswch Jan 22, 2023
1d1abbc
Update Notes.svelte
jaswch Mar 21, 2023
11703b0
Add files via upload
jaswch Mar 21, 2023
4956615
Update Notes.svelte
jaswch Mar 21, 2023
d817456
Delete public/Notes-icons directory
jaswch Mar 22, 2023
23a6b2e
Add files via upload
jaswch Mar 22, 2023
99567a1
Update Notes.svelte
jaswch Mar 22, 2023
b741a0a
Add files via upload
jaswch May 7, 2023
0df429d
Update apps.store.ts
jaswch May 7, 2023
fed2bc0
Update AppNexus.svelte
jaswch May 7, 2023
efbef61
Add files via upload
jaswch May 7, 2023
a8bbb3c
Update apps-config.ts
jaswch May 7, 2023
225f3d4
Update apps.store.ts
jaswch Jul 14, 2023
1575e17
Update apps-config.ts
jaswch Jul 14, 2023
4477485
Update AppNexus.svelte
jaswch Jul 14, 2023
7d1fa3f
Delete Finder.svelte
jaswch Jul 14, 2023
195abe1
Delete public/Finder-side-bar-icons directory
jaswch Jul 14, 2023
28b08eb
Update apps-config.ts
jaswch Jul 15, 2023
1118ff1
Update apps-config.ts
jaswch Jul 15, 2023
fce69a7
Merge pull request #2 from jaswch/jaswch-finder
jaswch Jul 15, 2023
3da7a40
Update apps-config.ts
jaswch Jul 15, 2023
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
Binary file added public/Notes-icons/New.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/Notes-icons/delete.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/Notes-icons/edit.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/app-icons/notes/256.png
Binary file not shown.
Binary file added public/app-icons/notes/256.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/apps/AppNexus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
{#await import('./VSCode/VSCode.svelte') then { default: VSCode }}
<VSCode {isBeingDragged} />
{/await}
{:else if appID === 'notes'}
{#await import('./Notes/Notes.svelte') then { default: Notes }}
<Notes />
{/await}
{:else if appID === 'calculator'}
{#await import('./Calculator/Calculator.svelte') then { default: Calculator }}
<Calculator />
Expand Down
145 changes: 145 additions & 0 deletions src/components/apps/Notes/Notes.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<script lang='ts'>
import { theme } from '🍎/stores/theme.store';
import {addNote, notesStore} from './store';

const NEW_NOTE = {title: '', text: ''};

let editing = false;
let note;
let selectedId;
let textInput;
let titleInput;

$: sortedNotes = Object.values($notesStore).sort();
$: note = $notesStore[selectedId] || NEW_NOTE;

function deleteNote() {
notesStore.update(notes => {
delete notes[note.id];
return notes;
});
}

function editNote() {
textInput.focus();
editing = true;
}

function handleSubmit() {
// do nothing for now
}

function newNote() {
selectedId = addNote('', '');
editing = true;
titleInput.focus();
}

</script>

<section class="container">
<header class="titlebar app-window-drag-handle">
<span>
<label for="title"/>
<input id="title" readonly={!editing} bind:this={titleInput} bind:value={note.title} />
</span>
<div>
<button disabled={!note.id} on:click={deleteNote}><img src="/Notes-icons/delete.webp" alt="delete"></button>
<button disabled={!note.id} on:click={editNote}><img src="/Notes-icons/edit.webp" alt="edit"></button>
<button on:click={newNote}><img src="/Notes-icons/New.webp" alt="new"></button>

</div>
</header>

<aside class:light={$theme.scheme === 'light'}>
<div>
<select bind:value={selectedId}>
<option>Select note</option>
{#each sortedNotes as note}
<option value={note.id}>{note.title}</option>
{/each}
</select>
</div>
</aside>

<section class="content">
<form on:submit|preventDefault={handleSubmit}>
<textarea readonly={!editing} rows="10" bind:this={textInput} bind:value={note.text} />
</form>
</section>
</section>


<style lang="scss">
.container {
--color: var(--system-color-light-hsl);

display: grid;
grid-template-columns: 12rem 1fr;
grid-template-rows: 3rem 1fr;

border-radius: inherit;

background-image: linear-gradient(
to right,
hsla(var(--color), 0.7) 12rem,
hsla(var(--color), 1) 12rem 100%
);

transition: --color 200ms ease-in;

color: var(--system-color-dark);
}

.titlebar {
grid-area: 1 / 1 / span 1 / span 2;

display: flex;
justify-content: right;

z-index: 1;

padding: 0.9rem 1rem;

width: 100%;

border-top-left-radius: inherit;
border-top-right-radius: inherit;

user-select: none;

}

.content {
border-top: solid 0.9px hsla(var(--system-color-dark-hsl), 0.3);
grid-area: 2 / 2 / span 1 / span 1;

display: flex;
flex-direction: column;
align-items: left;

padding: 1rem;
}

select{
border: none;
background: none;
color: hsla(var(--system-color-dark-hsl), 0.8);
}

textarea{
border: none;
background: none;
color: hsla(var(--system-color-dark-hsl), 0.8);
resize: none;
height: 295%;
width: 95%;
}

input{
border: none;
background: none;
color: hsla(var(--system-color-dark-hsl), 0.8);
font-size: large;
}
</style>
24 changes: 24 additions & 0 deletions src/components/apps/Notes/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {writable} from 'svelte/store';

let lastId = 0;

type Note = {
id: number;
title: string;
text: string;
}

// Keys are ids and values are objects with id, title, and text properties.
export const notesStore = writable<Record<number, Note>>({});

export function addNote(title: string, text: string) {
lastId++;
const note = {id: lastId, title, text};
notesStore.update(notes => {
notes[lastId] = note;
return notes;
});
return lastId;
}

addNote('About macOS web', 'macOS web is a web replica of macOS created in svelte.');
18 changes: 7 additions & 11 deletions src/configs/apps/apps-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,17 @@ const vscode = createAppConfig({
width: 800,
});

const finder = createAppConfig({
title: 'Finder',
const notes = createAppConfig({
title: 'Notes',
resizable: true,

// dockBreaksBefore: true,
shouldOpenWindow: false,
});

const safari = createAppConfig({
title: 'Safari',
const finder = createAppConfig({
title: 'Finder',
resizable: true,
});

const systemPreferences = createAppConfig({
title: 'System Preferences',
resizable: true,
// dockBreaksBefore: true,
shouldOpenWindow: true,
});

const purusTwitter = createAppConfig({
Expand Down Expand Up @@ -100,6 +95,7 @@ export const appsConfig = {
wallpapers,
calculator,
calendar,
notes,
vscode,
appstore,
// safari,
Expand Down
3 changes: 3 additions & 0 deletions src/stores/apps.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const openApps = writable<Record<AppID, boolean>>({
wallpapers: false,
finder: true,
vscode: false,
notes: false,
calculator: false,
// safari: false,
appstore: false,
Expand Down Expand Up @@ -35,6 +36,7 @@ export const appZIndices = writable<Record<AppID, number>>({
wallpapers: 0,
finder: 0,
vscode: 0,
notes: 0,
calculator: 0,
// safari: 0,
appstore: 0,
Expand All @@ -55,6 +57,7 @@ export const appsInFullscreen = writable<Record<AppID, boolean>>({
wallpapers: false,
finder: false,
vscode: false,
notes: false,
calculator: false,
// safari: false,
appstore: false,
Expand Down