-
-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karol Sójko
authored
May 23, 2022
1 parent
51248f2
commit 0e25885
Showing
28 changed files
with
134 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/assets/javascripts/Components/AccountMenu/AccountMenuPane.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export enum AccountMenuPane { | ||
GeneralMenu, | ||
SignIn, | ||
Register, | ||
ConfirmPassword, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const reloadFont = (monospaceFont?: boolean) => { | ||
const root = document.querySelector(':root') as HTMLElement | ||
const propertyName = '--sn-stylekit-editor-font-family' | ||
if (monospaceFont) { | ||
root.style.setProperty(propertyName, 'var(--sn-stylekit-monospace-font)') | ||
} else { | ||
root.style.setProperty(propertyName, 'var(--sn-stylekit-sans-serif-font)') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/assets/javascripts/Components/NoteView/TransactionFunctions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { SNComponent, SNNote, ComponentMutator, TransactionalMutation, ItemMutator } from '@standardnotes/snjs' | ||
|
||
export const transactionForAssociateComponentWithCurrentNote = (component: SNComponent, note: SNNote) => { | ||
const transaction: TransactionalMutation = { | ||
itemUuid: component.uuid, | ||
mutate: (m: ItemMutator) => { | ||
const mutator = m as ComponentMutator | ||
mutator.removeDisassociatedItemId(note.uuid) | ||
mutator.associateWithItem(note.uuid) | ||
}, | ||
} | ||
return transaction | ||
} | ||
|
||
export const transactionForDisassociateComponentWithCurrentNote = (component: SNComponent, note: SNNote) => { | ||
const transaction: TransactionalMutation = { | ||
itemUuid: component.uuid, | ||
mutate: (m: ItemMutator) => { | ||
const mutator = m as ComponentMutator | ||
mutator.removeAssociatedItemId(note.uuid) | ||
mutator.disassociateWithItem(note.uuid) | ||
}, | ||
} | ||
return transaction | ||
} |
2 changes: 1 addition & 1 deletion
2
app/assets/javascripts/Components/Preferences/Panes/Account/Authentication.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/assets/javascripts/Components/PurchaseFlow/Panes/CreateAccount.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
app/assets/javascripts/Components/PurchaseFlow/Panes/SignIn.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
app/assets/javascripts/Components/PurchaseFlow/PurchaseFlowFunctions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { WebApplication } from '@/UIModels/Application' | ||
import { getWindowUrlParams, isDesktopApplication } from '@/Utils' | ||
|
||
export const getPurchaseFlowUrl = async (application: WebApplication): Promise<string | undefined> => { | ||
const currentUrl = window.location.origin | ||
const successUrl = isDesktopApplication() ? 'standardnotes://' : currentUrl | ||
if (application.noAccount()) { | ||
return `${window.purchaseUrl}/offline?&success_url=${successUrl}` | ||
} | ||
const token = await application.getNewSubscriptionToken() | ||
if (token) { | ||
return `${window.purchaseUrl}?subscription_token=${token}&success_url=${successUrl}` | ||
} | ||
return undefined | ||
} | ||
|
||
export const loadPurchaseFlowUrl = async (application: WebApplication): Promise<boolean> => { | ||
const url = await getPurchaseFlowUrl(application) | ||
const params = getWindowUrlParams() | ||
const period = params.get('period') ? `&period=${params.get('period')}` : '' | ||
const plan = params.get('plan') ? `&plan=${params.get('plan')}` : '' | ||
if (url) { | ||
window.location.assign(`${url}${period}${plan}`) | ||
return true | ||
} | ||
return false | ||
} |
2 changes: 1 addition & 1 deletion
2
app/assets/javascripts/Components/PurchaseFlow/PurchaseFlowView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export enum AppStateEvent { | ||
TagChanged, | ||
ActiveEditorChanged, | ||
PanelResized, | ||
EditorFocused, | ||
BeganBackupDownload, | ||
EndedBackupDownload, | ||
WindowDidFocus, | ||
WindowDidBlur, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum PurchaseFlowPane { | ||
SignIn, | ||
CreateAccount, | ||
} |
8 changes: 2 additions & 6 deletions
8
app/assets/javascripts/UIModels/AppState/PurchaseFlowState.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.