refactor: various tweaks and fixes

This commit is contained in:
Henry
2025-09-11 13:56:58 +01:00
parent f67457b9b5
commit c4220580e5
4 changed files with 26 additions and 11 deletions

View File

@@ -42,7 +42,7 @@ type FormValues = z.infer<typeof schema>;
export function NewWorkspaceForm() { export function NewWorkspaceForm() {
const { closeModal } = useModal(); const { closeModal } = useModal();
const { showPopup } = usePopup(); const { showPopup } = usePopup();
const { switchWorkspace } = useWorkspace(); const { switchWorkspace, availableWorkspaces } = useWorkspace();
const { const {
register, register,
handleSubmit, handleSubmit,
@@ -60,6 +60,8 @@ export function NewWorkspaceForm() {
}); });
const utils = api.useUtils(); const utils = api.useUtils();
const hasAvailableWorkspaces = availableWorkspaces.length > 0;
const isCloudEnv = env("NEXT_PUBLIC_KAN_ENV") === "cloud"; const isCloudEnv = env("NEXT_PUBLIC_KAN_ENV") === "cloud";
const slug = watch("slug"); const slug = watch("slug");
@@ -209,7 +211,10 @@ export function NewWorkspaceForm() {
</h2> </h2>
<button <button
type="button" type="button"
className="rounded p-1 hover:bg-light-200 focus:outline-none dark:hover:bg-dark-300" className={twMerge(
"rounded p-1 hover:bg-light-200 focus:outline-none dark:hover:bg-dark-300",
!hasAvailableWorkspaces && "invisible",
)}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
closeModal(); closeModal();
@@ -306,9 +311,14 @@ export function NewWorkspaceForm() {
</div> </div>
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<HiCheckBadge className="h-[18px] w-[18px] flex-shrink-0 text-light-1000 dark:text-dark-950" /> <HiCheckBadge className="h-[18px] w-[18px] flex-shrink-0 text-light-1000 dark:text-dark-950" />
<span className="text-xs text-neutral-900 dark:text-dark-1000"> <div className="flex items-center space-x-2">
{t`Board analytics (coming soon)`} <span className="text-xs text-neutral-900 dark:text-dark-1000">
</span> {t`Board analytics`}
</span>
<span className="inline-flex items-center rounded-full bg-gray-500/10 px-2 py-0.5 text-[10px] font-medium text-gray-600 ring-1 ring-inset ring-gray-500/20 dark:text-gray-400 sm:text-[10px]">
{t`Coming soon`}
</span>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -14,9 +14,9 @@ import { NewBoardForm } from "./components/NewBoardForm";
export default function BoardsPage() { export default function BoardsPage() {
const { openModal, modalContentType, isOpen } = useModal(); const { openModal, modalContentType, isOpen } = useModal();
const { workspace, hasLoaded } = useWorkspace(); const { availableWorkspaces, workspace, hasLoaded } = useWorkspace();
if (hasLoaded && !workspace.publicId) openModal("NEW_WORKSPACE"); if (hasLoaded && availableWorkspaces.length === 0) openModal("NEW_WORKSPACE");
return ( return (
<> <>

View File

@@ -76,9 +76,14 @@ export function UpgradeToProConfirmation({
</div> </div>
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<HiCheckBadge className="h-5 w-5 flex-shrink-0 text-light-1000 dark:text-dark-950" /> <HiCheckBadge className="h-5 w-5 flex-shrink-0 text-light-1000 dark:text-dark-950" />
<span className="text-sm text-neutral-900 dark:text-dark-1000"> <div className="flex items-center space-x-2">
{t`Board analytics (coming soon)`} <span className="text-xs text-neutral-900 dark:text-dark-1000">
</span> {t`Board analytics`}
</span>
<span className="inline-flex items-center rounded-full bg-gray-500/10 px-2 py-0.5 text-[10px] font-medium text-gray-600 ring-1 ring-inset ring-gray-500/20 dark:text-gray-400 sm:text-[10px]">
{t`Coming soon`}
</span>
</div>
</div> </div>
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<HiCheckBadge className="h-5 w-5 flex-shrink-0 text-light-1000 dark:text-dark-950" /> <HiCheckBadge className="h-5 w-5 flex-shrink-0 text-light-1000 dark:text-dark-950" />

View File

@@ -14,7 +14,7 @@ export interface Subscription {
unlimitedSeats: boolean; unlimitedSeats: boolean;
periodStart: Date | null; periodStart: Date | null;
periodEnd: Date | null; periodEnd: Date | null;
referenceId: string; referenceId: string | null;
stripeSubscriptionId: string | null; stripeSubscriptionId: string | null;
stripeCustomerId: string | null; stripeCustomerId: string | null;
createdAt: Date; createdAt: Date;