2023-07-27 18:59:40 -04:00
|
|
|
import { ActionButton } from '../components/ActionButton'
|
|
|
|
import { isTauri } from '../lib/isTauri'
|
|
|
|
import { invoke } from '@tauri-apps/api/tauri'
|
2023-08-08 09:06:14 +10:00
|
|
|
import { VITE_KC_SITE_BASE_URL, VITE_KC_API_BASE_URL } from '../env'
|
2023-08-28 20:31:49 -04:00
|
|
|
import { Themes, getSystemTheme } from '../lib/theme'
|
2023-08-10 13:30:32 -04:00
|
|
|
import { paths } from '../Router'
|
2023-08-29 10:48:55 -04:00
|
|
|
import { useGlobalStateContext } from 'hooks/useGlobalStateContext'
|
2023-12-18 06:15:26 -05:00
|
|
|
import { APP_NAME } from 'lib/constants'
|
2023-07-27 18:59:40 -04:00
|
|
|
|
|
|
|
const SignIn = () => {
|
2023-08-29 10:48:55 -04:00
|
|
|
const {
|
|
|
|
auth: { send },
|
|
|
|
settings: {
|
|
|
|
state: {
|
|
|
|
context: { theme },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} = useGlobalStateContext()
|
|
|
|
|
2023-08-09 15:41:41 -04:00
|
|
|
const appliedTheme = theme === Themes.System ? getSystemTheme() : theme
|
2023-07-27 18:59:40 -04:00
|
|
|
const signInTauri = async () => {
|
|
|
|
// We want to invoke our command to login via device auth.
|
|
|
|
try {
|
2023-08-08 09:06:14 +10:00
|
|
|
const token: string = await invoke('login', {
|
|
|
|
host: VITE_KC_API_BASE_URL,
|
|
|
|
})
|
2023-08-28 20:31:49 -04:00
|
|
|
send({ type: 'Log in', token })
|
2023-07-27 18:59:40 -04:00
|
|
|
} catch (error) {
|
|
|
|
console.error('login button', error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-08-09 15:41:41 -04:00
|
|
|
<main className="body-bg h-full min-h-screen m-0 p-0 pt-24">
|
2023-07-27 18:59:40 -04:00
|
|
|
<div className="max-w-2xl mx-auto">
|
|
|
|
<div>
|
|
|
|
<img
|
2023-08-09 15:41:41 -04:00
|
|
|
src={`/kittycad-logomark${
|
|
|
|
appliedTheme === Themes.Dark ? '-light' : ''
|
|
|
|
}.svg`}
|
2023-07-27 18:59:40 -04:00
|
|
|
alt="KittyCAD"
|
|
|
|
className="w-48 inline-block"
|
|
|
|
/>
|
|
|
|
<span className="text-3xl leading-none w-auto inline-block align-middle ml-2">
|
|
|
|
Modeling App
|
|
|
|
</span>
|
|
|
|
</div>
|
2023-08-09 15:41:41 -04:00
|
|
|
<h1 className="font-bold text-2xl mt-12 mb-6">
|
2023-12-18 06:15:26 -05:00
|
|
|
Sign in to get started with the {APP_NAME}
|
2023-07-27 18:59:40 -04:00
|
|
|
</h1>
|
|
|
|
<p className="py-4">
|
2023-12-18 06:15:26 -05:00
|
|
|
ZMA is an open-source CAD application for creating accurate 3D models
|
|
|
|
for use in manufacturing. It is built on top of KittyCAD, the design
|
|
|
|
API from Zoo. Zoo is the first software infrastructure company built
|
|
|
|
specifically for the needs of the manufacturing industry. With ZMA we
|
|
|
|
are showing how the KittyCAD API from Zoo can be used to build
|
|
|
|
entirely new kinds of software for manufacturing.
|
2023-07-27 18:59:40 -04:00
|
|
|
</p>
|
|
|
|
<p className="py-4">
|
2023-12-18 06:15:26 -05:00
|
|
|
ZMA is currently in development. If you would like to be notified when
|
|
|
|
ZMA is ready for production, please sign up for our mailing list at{' '}
|
|
|
|
<a href="https://zoo.dev">zoo.dev</a>.
|
2023-07-27 18:59:40 -04:00
|
|
|
</p>
|
|
|
|
{isTauri() ? (
|
|
|
|
<ActionButton
|
2023-08-15 21:56:24 -04:00
|
|
|
Element="button"
|
2023-07-27 18:59:40 -04:00
|
|
|
onClick={signInTauri}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
icon={{ icon: 'arrowRight' }}
|
2023-07-27 18:59:40 -04:00
|
|
|
className="w-fit mt-4"
|
2023-11-29 05:15:04 -05:00
|
|
|
data-testid="sign-in-button"
|
2023-07-27 18:59:40 -04:00
|
|
|
>
|
|
|
|
Sign in
|
|
|
|
</ActionButton>
|
|
|
|
) : (
|
|
|
|
<ActionButton
|
|
|
|
Element="link"
|
2023-08-10 13:30:32 -04:00
|
|
|
to={`${VITE_KC_SITE_BASE_URL}${
|
|
|
|
paths.SIGN_IN
|
|
|
|
}?callbackUrl=${encodeURIComponent(
|
2023-07-27 18:59:40 -04:00
|
|
|
typeof window !== 'undefined' &&
|
|
|
|
window.location.href.replace('signin', '')
|
|
|
|
)}`}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
icon={{ icon: 'arrowRight' }}
|
2023-08-09 15:41:41 -04:00
|
|
|
className="w-fit mt-4"
|
2023-07-27 18:59:40 -04:00
|
|
|
>
|
|
|
|
Sign in
|
|
|
|
</ActionButton>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SignIn
|