Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
32 changes: 32 additions & 0 deletions public/images/cursor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"neovim": "Download Testaustime for Neovim",
"title": "Extensions",
"vscode": "Download Testaustime for Visual Studio Code",
"cursor": "Download Testaustime for Cursor",
"sublime": "Download Testaustime for Sublime Text"
},
"footer": {
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"extensions": {
"body": "Lataa Testaustime-laajennus suosikkieditorillesi!",
"cursor": "Lataa Testaustime Cursor:lle",
"intellij": "Lataa Testaustime IntelliJ:lle",
"micro": "Lataa Testaustime Micro:lle",
"neovim": "Lataa Testaustime Neovim:lle",
Expand Down Expand Up @@ -308,7 +309,7 @@
}
},
"authorize": {
"body": "Olet kirjautumassa sisään viralliseen Visual Studio Code -lisäosaan.",
"body": "Olet kirjautumassa sisään viralliseen {{editor}} -lisäosaan.",
"continue": "Jatka käyttäjänä {{username}}",
"notWorking": {
"text": "Eikö toimi?",
Expand Down
12 changes: 10 additions & 2 deletions src/app/[locale]/authorize/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default async function AuthorizePage({
const loginUrl =
editor == "vscode"
? `/login?redirect=${encodeURIComponent("/authorize?editor=vscode")}`
: editor == ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be cursor instead?

Suggested change
: editor == ""
: editor == "cursor"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also could use something like this so it's easier to extend in the future

const loginUrls = new Map(Object.entries({
  vscode: `/login?redirect=${encodeURIComponent("/authorize?editor=vscode")}`,
  cursor: `/login?redirect=${encodeURIComponent("/authorize?editor=cursor")}`
}))
const loginUrl = loginUrls.get(editor)

if (loginUrl === undefined) {
  // Make this prettier
  return <div>Unsupported editor</div>
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better in my opinion.

? `/login?redirect=${encodeURIComponent("/authorize?editor=cursor")}`
: "/login";

const token = cookies().get("token")?.value;
Expand All @@ -32,6 +34,8 @@ export default async function AuthorizePage({

const { username } = me;

const editorName = editor == "vscode" ? "Visual Studio Code" : "Cursor";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar change here as I commented above

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. that wasn't better thing, but I did that anyway.


return (
<Stack align="center" gap="xl">
<Image
Expand All @@ -40,10 +44,14 @@ export default async function AuthorizePage({
width={40}
height={40}
/>
<Text>{t("authorize.body")}</Text>
<Text>{t("authorize.body", { editor: editorName })}</Text>
<Button
component="a"
href={`vscode://testausserveri-ry.testaustime/authorize?token=${token}`}
href={
editor == "vscode"
? `vscode://testausserveri-ry.testaustime/authorize?token=${token}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here too

: `cursor://testausserveri-ry.testaustime/authorize?token=${token}`
}
>
{t("authorize.continue", { username })}
</Button>
Expand Down
7 changes: 7 additions & 0 deletions src/app/[locale]/extensions/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ export default async function ExtensionsPage({
sourceCodeLink="https://github.com/Testausserveri/testaustime-vscode"
text={t("extensions.vscode")}
/>
<ExtensionBlock
logo="/images/cursor.svg"
alt="Cursor logo"
downloadLink="https://marketplace.visualstudio.com/items?itemName=testausserveri-ry.testaustime"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the VS Code extension

sourceCodeLink="https://github.com/Testausserveri/testaustime-cursor"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the repo in process of being moved under Testaustime (or at least Testausserveri) organization? At least I didn't see any messages in Discord about that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. we'll talk about that in discord.

text={t("extensions.cursor")}
/>
<ExtensionBlock
logo="/images/neovim.svg"
alt="Neovim logo"
Expand Down
Loading