format
This commit is contained in:
@@ -76,8 +76,8 @@ function Gooey() {
|
|||||||
const z = randomSign(Math.random() * 2)
|
const z = randomSign(Math.random() * 2)
|
||||||
const position: [number, number, number] = [x, z, y]
|
const position: [number, number, number] = [x, z, y]
|
||||||
const size = Math.random() * 0.8 + 0.1
|
const size = Math.random() * 0.8 + 0.1
|
||||||
const distort = (size > .1) ? Math.random() * .6 * size + 0.2 : 0
|
const distort = size > 0.1 ? Math.random() * 0.6 * size + 0.2 : 0
|
||||||
const speed = (size > .1) ? (Math.random() * 0.8) / size / size + 0.1 : 0
|
const speed = size > 0.1 ? (Math.random() * 0.8) / size / size + 0.1 : 0
|
||||||
return { position, size, distort, speed }
|
return { position, size, distort, speed }
|
||||||
})
|
})
|
||||||
const secondSet = Array.from({ length: 5 }).map((_, index) => {
|
const secondSet = Array.from({ length: 5 }).map((_, index) => {
|
||||||
@@ -87,8 +87,8 @@ function Gooey() {
|
|||||||
const z = randomSign(Math.random() * 2)
|
const z = randomSign(Math.random() * 2)
|
||||||
const position: [number, number, number] = [x, z, y]
|
const position: [number, number, number] = [x, z, y]
|
||||||
const size = Math.random() * 0.2 + 0.05
|
const size = Math.random() * 0.2 + 0.05
|
||||||
const distort = (size > .1) ? Math.random() * .8 * size + 0.2 : 0
|
const distort = size > 0.1 ? Math.random() * 0.8 * size + 0.2 : 0
|
||||||
const speed = (size > .1) ? (Math.random() * 0.5) / size / size + 0.1 : 0
|
const speed = size > 0.1 ? (Math.random() * 0.5) / size / size + 0.1 : 0
|
||||||
return { position, size, distort, speed }
|
return { position, size, distort, speed }
|
||||||
})
|
})
|
||||||
return [...firstSet, ...secondSet]
|
return [...firstSet, ...secondSet]
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ export const sidebarTopConfig: SidebarConfigType[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const DiscordLink = () => (
|
const DiscordLink = () => (
|
||||||
<a className="underline text-ch-pink-300"
|
<a
|
||||||
|
className="underline text-ch-pink-300"
|
||||||
href="https://discord.gg/SD7zFRNjGH"
|
href="https://discord.gg/SD7zFRNjGH"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
@@ -74,7 +75,8 @@ const settingsConfig = [
|
|||||||
</p>
|
</p>
|
||||||
<hr className="my-2" />
|
<hr className="my-2" />
|
||||||
<p className="p-2">
|
<p className="p-2">
|
||||||
We're building configuration settings for the Viewer pane now. Join us on <DiscordLink/> if you want to lend a hand!
|
We're building configuration settings for the Viewer pane now. Join us
|
||||||
|
on <DiscordLink /> if you want to lend a hand!
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@@ -90,7 +92,8 @@ const settingsConfig = [
|
|||||||
</p>
|
</p>
|
||||||
<hr className="my-2" />
|
<hr className="my-2" />
|
||||||
<p className="p-2">
|
<p className="p-2">
|
||||||
We're building configuration settings for the Viewer pane now. Join us on <DiscordLink/> if you want to lend a hand!
|
We're building configuration settings for the Viewer pane now. Join us
|
||||||
|
on <DiscordLink /> if you want to lend a hand!
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
@@ -106,7 +109,8 @@ const settingsConfig = [
|
|||||||
</p>
|
</p>
|
||||||
<hr className="my-2" />
|
<hr className="my-2" />
|
||||||
<p className="p-2">
|
<p className="p-2">
|
||||||
We're building configuration settings for the Viewer pane now. Join us on <DiscordLink/> if you want to lend a hand!
|
We're building configuration settings for the Viewer pane now. Join us
|
||||||
|
on <DiscordLink /> if you want to lend a hand!
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ interface EditToggleType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EditToggle = ({
|
const EditToggle = ({
|
||||||
onEdit = () => { console.error('Field declared editable without edit action.') },
|
onEdit = () => {
|
||||||
|
console.error('Field declared editable without edit action.')
|
||||||
|
},
|
||||||
isEditing = false,
|
isEditing = false,
|
||||||
} : EditToggleType) => (
|
}: EditToggleType) =>
|
||||||
(isEditing ? (
|
isEditing ? (
|
||||||
<button
|
<button
|
||||||
className="font-fira-sans text-ch-gray-300 items-center ml-4 grid grid-flow-col-dense p-px px-2 gap-2 bg-ch-blue-500 bg-opacity-50 hover:bg-opacity-70 rounded-sm"
|
className="font-fira-sans text-ch-gray-300 items-center ml-4 grid grid-flow-col-dense p-px px-2 gap-2 bg-ch-blue-500 bg-opacity-50 hover:bg-opacity-70 rounded-sm"
|
||||||
id="rename-button"
|
id="rename-button"
|
||||||
@@ -23,7 +25,6 @@ const EditToggle = ({
|
|||||||
<button onClick={onEdit}>
|
<button onClick={onEdit}>
|
||||||
<Svg name="pencil-solid" className="h-4 w-4 ml-4 mb-2" />
|
<Svg name="pencil-solid" className="h-4 w-4 ml-4 mb-2" />
|
||||||
</button>
|
</button>
|
||||||
))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
interface KeyValueType {
|
interface KeyValueType {
|
||||||
|
|||||||
@@ -32,10 +32,7 @@ const ProjectCard = ({ title, mainImage, user, Reaction, cadPackage }) => (
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center mt-1">
|
<div className="flex items-center mt-1">
|
||||||
<div className="w-8 h-8 overflow-hidden rounded-full border border-ch-gray-300 shadow">
|
<div className="w-8 h-8 overflow-hidden rounded-full border border-ch-gray-300 shadow">
|
||||||
<ImageFallback
|
<ImageFallback imageId={user?.image} width={80} />
|
||||||
imageId={user?.image}
|
|
||||||
width={80}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="ml-3 text-lg text-ch-gray-300 font-fira-sans">
|
<div className="ml-3 text-lg text-ch-gray-300 font-fira-sans">
|
||||||
<div className="">{title}</div>
|
<div className="">{title}</div>
|
||||||
|
|||||||
@@ -102,7 +102,8 @@ const ProjectProfile = ({
|
|||||||
className="px-3 py-2 rounded"
|
className="px-3 py-2 rounded"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{ (project?.description || hasPermissionToEdit) && <KeyValue
|
{(project?.description || hasPermissionToEdit) && (
|
||||||
|
<KeyValue
|
||||||
keyName="Description"
|
keyName="Description"
|
||||||
edit={{
|
edit={{
|
||||||
hasPermissionToEdit,
|
hasPermissionToEdit,
|
||||||
@@ -136,7 +137,8 @@ const ProjectProfile = ({
|
|||||||
onChange={onDescriptionChange}
|
onChange={onDescriptionChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</KeyValue> }
|
</KeyValue>
|
||||||
|
)}
|
||||||
<div className="grid grid-flow-col-dense gap-6">
|
<div className="grid grid-flow-col-dense gap-6">
|
||||||
<KeyValue keyName="Created on">
|
<KeyValue keyName="Created on">
|
||||||
{new Date(project?.createdAt).toDateString()}
|
{new Date(project?.createdAt).toDateString()}
|
||||||
@@ -154,7 +156,8 @@ const ProjectProfile = ({
|
|||||||
className=""
|
className=""
|
||||||
/>
|
/>
|
||||||
</KeyValue>
|
</KeyValue>
|
||||||
{ currentUser && <KeyValue keyName="Comments">
|
{currentUser && (
|
||||||
|
<KeyValue keyName="Comments">
|
||||||
{!isEditing && (
|
{!isEditing && (
|
||||||
<>
|
<>
|
||||||
{currentUser && (
|
{currentUser && (
|
||||||
@@ -190,7 +193,9 @@ const ProjectProfile = ({
|
|||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<Link
|
<Link
|
||||||
className="flex items-center"
|
className="flex items-center"
|
||||||
to={routes.user({ userName: user?.userName })}
|
to={routes.user({
|
||||||
|
userName: user?.userName,
|
||||||
|
})}
|
||||||
>
|
>
|
||||||
<Gravatar
|
<Gravatar
|
||||||
image={user?.image}
|
image={user?.image}
|
||||||
@@ -211,7 +216,8 @@ const ProjectProfile = ({
|
|||||||
</ul>
|
</ul>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</KeyValue> }
|
</KeyValue>
|
||||||
|
)}
|
||||||
{hasPermissionToEdit && (
|
{hasPermissionToEdit && (
|
||||||
<>
|
<>
|
||||||
<h4 className="mt-10 text-red-600">Danger Zone</h4>
|
<h4 className="mt-10 text-red-600">Danger Zone</h4>
|
||||||
|
|||||||
@@ -13,15 +13,18 @@ import {
|
|||||||
|
|
||||||
// This function initializes the state management object for each of the fields
|
// This function initializes the state management object for each of the fields
|
||||||
function buildFieldsConfig(fieldsConfig, user, hasPermissionToEdit) {
|
function buildFieldsConfig(fieldsConfig, user, hasPermissionToEdit) {
|
||||||
return Object.fromEntries(Object.keys(fieldsConfig).map(
|
return Object.fromEntries(
|
||||||
(key: string): [string, FieldType] => ([key, {
|
Object.keys(fieldsConfig).map((key: string): [string, FieldType] => [
|
||||||
|
key,
|
||||||
|
{
|
||||||
name: key,
|
name: key,
|
||||||
currentValue: user[key],
|
currentValue: user[key],
|
||||||
newValue: user[key],
|
newValue: user[key],
|
||||||
isEditing: false,
|
isEditing: false,
|
||||||
hasPermissionToEdit,
|
hasPermissionToEdit,
|
||||||
}])
|
},
|
||||||
))
|
])
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserProfile = ({
|
const UserProfile = ({
|
||||||
@@ -39,7 +42,11 @@ const UserProfile = ({
|
|||||||
navigate(routes.user({ userName: user.userName }))
|
navigate(routes.user({ userName: user.userName }))
|
||||||
}, [currentUser])
|
}, [currentUser])
|
||||||
|
|
||||||
const initializedFields = buildFieldsConfig(fieldComponents, user, hasPermissionToEdit)
|
const initializedFields = buildFieldsConfig(
|
||||||
|
fieldComponents,
|
||||||
|
user,
|
||||||
|
hasPermissionToEdit
|
||||||
|
)
|
||||||
const [fields, fieldDispatch] = useReducer(fieldReducer, initializedFields)
|
const [fields, fieldDispatch] = useReducer(fieldReducer, initializedFields)
|
||||||
const {
|
const {
|
||||||
name: NameField,
|
name: NameField,
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ const ProfileKeyValue = ({
|
|||||||
bottom = false,
|
bottom = false,
|
||||||
}: ProfileKeyValueType) => {
|
}: ProfileKeyValueType) => {
|
||||||
return (
|
return (
|
||||||
(user[field.name] && hasPermissionToEdit) && <KeyValue
|
user[field.name] &&
|
||||||
|
hasPermissionToEdit && (
|
||||||
|
<KeyValue
|
||||||
keyName={field.name}
|
keyName={field.name}
|
||||||
edit={{
|
edit={{
|
||||||
hasPermissionToEdit,
|
hasPermissionToEdit,
|
||||||
@@ -75,6 +77,7 @@ const ProfileKeyValue = ({
|
|||||||
{children}
|
{children}
|
||||||
</KeyValue>
|
</KeyValue>
|
||||||
)
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function BioField(props) {
|
function BioField(props) {
|
||||||
@@ -196,7 +199,8 @@ export function fieldReducer(state, action) {
|
|||||||
[action.payload]: {
|
[action.payload]: {
|
||||||
...state[action.payload],
|
...state[action.payload],
|
||||||
isEditing:
|
isEditing:
|
||||||
state[action.payload].hasPermissionToEdit && !state[action.payload].isEditing
|
state[action.payload].hasPermissionToEdit &&
|
||||||
|
!state[action.payload].isEditing
|
||||||
? true
|
? true
|
||||||
: false,
|
: false,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user