Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycarambat committed Dec 4, 2023
1 parent ca8bf52 commit 203f596
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
10 changes: 3 additions & 7 deletions frontend/src/components/Modals/NewWorkspace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function NewWorkspaceModal({ hideModal = noop }) {
const form = new FormData(formEl.current);
for (var [key, value] of form.entries()) data[key] = value;
const { workspace, message } = await Workspace.new(data);
if (!!workspace){
if (!!workspace) {
window.location.href = paths.workspace.chat(workspace.slug);
}
setError(message);
Expand All @@ -29,9 +29,7 @@ export default function NewWorkspaceModal({ hideModal = noop }) {
<div className="relative w-[500px] max-h-full">
<div className="relative bg-modal-gradient rounded-lg shadow-md border-2 border-accent">
<div className="flex items-start justify-between p-4 border-b rounded-t border-white/10">
<h3 className="text-xl font-semibold text-white">
New Workspace
</h3>
<h3 className="text-xl font-semibold text-white">New Workspace</h3>
<button
onClick={hideModal}
type="button"
Expand Down Expand Up @@ -61,9 +59,7 @@ export default function NewWorkspaceModal({ hideModal = noop }) {
/>
</div>
{error && (
<p className="text-red-400 text-sm">
Error: {error}
</p>
<p className="text-red-400 text-sm">Error: {error}</p>
)}
</div>
</div>
Expand Down
24 changes: 12 additions & 12 deletions frontend/src/components/UserMenu/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { useState, useEffect, useRef } from 'react';
import { isMobile } from 'react-device-detect';
import paths from '../../utils/paths';
import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from '../../utils/constants';
import { Person, SignOut } from '@phosphor-icons/react';
import { userFromStorage } from '../../utils/request';
import React, { useState, useEffect, useRef } from "react";
import { isMobile } from "react-device-detect";
import paths from "../../utils/paths";
import { AUTH_TIMESTAMP, AUTH_TOKEN, AUTH_USER } from "../../utils/constants";
import { Person, SignOut } from "@phosphor-icons/react";
import { userFromStorage } from "../../utils/request";

export default function UserMenu({ children }) {
if (isMobile) return <>{children}</>;
Expand All @@ -20,14 +20,14 @@ function useLoginMode() {
const user = !!window.localStorage.getItem(AUTH_USER);
const token = !!window.localStorage.getItem(AUTH_TOKEN);

if (user && token) return 'multi';
if (!user && token) return 'single';
if (user && token) return "multi";
if (!user && token) return "single";
return null;
}

function userDisplay() {
const user = userFromStorage();
return user?.username?.slice(0, 2) || 'AA';
return user?.username?.slice(0, 2) || "AA";
}

function UserButton() {
Expand All @@ -47,9 +47,9 @@ function UserButton() {

useEffect(() => {
if (showMenu) {
document.addEventListener('mousedown', handleClose);
document.addEventListener("mousedown", handleClose);
}
return () => document.removeEventListener('mousedown', handleClose);
return () => document.removeEventListener("mousedown", handleClose);
}, [showMenu]);

if (mode === null) return null;
Expand All @@ -62,7 +62,7 @@ function UserButton() {
type="button"
className="uppercase transition-all duration-300 w-[35px] h-[35px] text-base font-semibold rounded-full flex items-center bg-sidebar-button hover:bg-menu-item-selected-gradient justify-center text-white p-2 hover:border-slate-100 hover:border-opacity-50 border-transparent border"
>
{mode === 'multi' ? userDisplay() : <Person size={14} />}
{mode === "multi" ? userDisplay() : <Person size={14} />}
</button>

{showMenu && (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@ dialog::backdrop {
100% {
opacity: 0;
}
}
}

0 comments on commit 203f596

Please sign in to comment.