Skip to content
Snippets Groups Projects
Commit 2fa529eb authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge branch 'vitehotfixes' into 'main'

Hot fixes for vite

See merge request !110
parents 88f7c11a cc4e9f13
Branches main
No related tags found
1 merge request!110Hot fixes for vite
...@@ -50,3 +50,6 @@ dist/ ...@@ -50,3 +50,6 @@ dist/
# Bun # Bun
bun.lockb bun.lockb
# Local Netlify folder
.netlify
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
command = "bun run build" command = "bun run build"
publish = "dist" publish = "dist"
[dev]
command = "bun run dev"
port = 3001
targetPort = 3000
publish = "dist"
framework = "vite"
autoLaunch = true
# Handle React Router # Handle React Router
[[redirects]] [[redirects]]
from = "/*" from = "/*"
...@@ -16,7 +24,7 @@ ...@@ -16,7 +24,7 @@
X-XSS-Protection = "1; mode=block" X-XSS-Protection = "1; mode=block"
X-Content-Type-Options = "nosniff" X-Content-Type-Options = "nosniff"
Referrer-Policy = "strict-origin-when-cross-origin" Referrer-Policy = "strict-origin-when-cross-origin"
Content-Security-Policy = "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; connect-src 'self' https:;" Content-Security-Policy = "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https:; connect-src 'self' https:; worker-src 'self' blob:; child-src 'self' blob:;"
# Cache control for static assets # Cache control for static assets
[[headers]] [[headers]]
......
...@@ -19,10 +19,10 @@ const Input: FC<Props> = ({ size = 'md', ...props }) => ( ...@@ -19,10 +19,10 @@ const Input: FC<Props> = ({ size = 'md', ...props }) => (
w-full block w-full block
rounded-[1.5rem] rounded-[1.5rem]
px-4 px-4
bg-transparent bg-charcoal-4
border border-[var(--charcoal-1)] border border-charcoal-1
focus:outline-none focus:border-[var(--primary)] focus:outline-none focus:border-primary
placeholder:text-sm placeholder:text-[var(--charcoal-1)] placeholder:text-sm placeholder:text-charcoal-1
${sizeMap[size]} ${sizeMap[size]}
${props.className || ''} ${props.className || ''}
`} `}
......
...@@ -55,16 +55,44 @@ const CreateChannelView: FC = () => { ...@@ -55,16 +55,44 @@ const CreateChannelView: FC = () => {
const onCreate = useCallback(async () => { const onCreate = useCallback(async () => {
if (error) { if (error) {
console.error('Validation error:', error);
return; return;
} }
const trimmedName = channelName.trim();
// Log the actual values for debugging
console.log('Attempting to create channel with:', {
name: trimmedName,
nameLength: trimmedName.length,
description: channelDesc,
privacyLevel,
dmsEnabled
});
try { try {
createChannel(channelName, channelDesc, privacyLevel, dmsEnabled); if (!trimmedName) {
alert({
type: 'error',
content: t('Channel name is required')
});
return;
}
if (!regex.test(trimmedName)) {
alert({
type: 'error',
content: t('Invalid channel name format')
});
return;
}
await createChannel(trimmedName, channelDesc, privacyLevel, dmsEnabled);
setChannelName(''); setChannelName('');
setChannelDesc(''); setChannelDesc('');
closeModal(); closeModal();
} catch (e) { } catch (e) {
console.error((e as any).message); console.error('Failed to create channel:', e);
alert({ alert({
type: 'error', type: 'error',
content: t('Something wrong happened, please check your details.') content: t('Something wrong happened, please check your details.')
...@@ -89,7 +117,17 @@ const CreateChannelView: FC = () => { ...@@ -89,7 +117,17 @@ const CreateChannelView: FC = () => {
<ModalTitle>{t('Create New Space')}</ModalTitle> <ModalTitle>{t('Create New Space')}</ModalTitle>
<div className='space-y-4 w-full'> <div className='space-y-4 w-full'>
<Input <Input
className={cn({ 'border-red text-red placeholder:text-red': !!nameError })} autoFocus
className={cn(`
focus:border-primary
focus-visible:outline-none w-full
rounded-2xl bg-charcoal-4 border border-charcoal-1 px-4 py-2
placeholder-charcoal-1 placeholder:text-sm
transition-all`,
{
'border-red text-red': !!nameError
}
)}
data-testid='channel-name-input' data-testid='channel-name-input'
type='text' type='text'
placeholder={t('Name')} placeholder={t('Name')}
...@@ -103,8 +141,7 @@ const CreateChannelView: FC = () => { ...@@ -103,8 +141,7 @@ const CreateChannelView: FC = () => {
onChange={onChannelNameChange} onChange={onChannelNameChange}
/> />
<textarea <textarea
className={cn( className={cn(`
`
focus:border-primary focus:border-primary
focus-visible:outline-none resize-none h-10 active:outline-0 w-full focus-visible:outline-none resize-none h-10 active:outline-0 w-full
rounded-2xl bg-charcoal-4 border border-charcoal-1 px-4 py-2 rounded-2xl bg-charcoal-4 border border-charcoal-1 px-4 py-2
......
...@@ -1108,6 +1108,22 @@ export const NetworkProvider: FC<WithChildren> = (props) => { ...@@ -1108,6 +1108,22 @@ export const NetworkProvider: FC<WithChildren> = (props) => {
} }
}, [channelManager, fetchInitialData]); }, [channelManager, fetchInitialData]);
useEffect(() => {
if (!utils) return;
const interval = setInterval(() => {
try {
// Try to call a simple WASM function to check if it's still responsive
utils.GetWasmSemanticVersion();
} catch (error) {
console.error('WASM appears to be non-responsive, refreshing page...', error);
window.location.reload();
}
}, 10000); // Check every 10 seconds
return () => clearInterval(interval);
}, [utils]);
const ctx: NetworkContext = { const ctx: NetworkContext = {
decryptMessageContent: cipher?.decrypt, decryptMessageContent: cipher?.decrypt,
channelManager, channelManager,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment