Skip to content

Commit f2cbffe

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
fix: resolve build errors (SessionState types, unused vars, RepresentationType mismatch)
1 parent 43d6189 commit f2cbffe

3 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/components/Controls.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ export const Controls: React.FC<ControlsProps> = ({
428428
setCustomColors,
429429
chainStyles, // Destructure
430430
setChainStyle, // Destructure
431-
customStyles,
431+
customStyles = [],
432432
setCustomStyles,
433-
customTransparency,
433+
customTransparency = [],
434434
setCustomTransparency,
435-
smoothSheetEnabled,
435+
smoothSheetEnabled = false,
436436
chains,
437437
ligands,
438438

@@ -1600,7 +1600,7 @@ export const Controls: React.FC<ControlsProps> = ({
16001600
)}
16011601

16021602
{/* ADVANCED STYLES WRAPPER */}
1603-
{(setChainStyle && chainStyles && chains.length > 0) || (setCustomStyles && customStyles) ? (
1603+
{(setChainStyle && chainStyles && chains.length > 0) || (true) ? (
16041604
<div className="col-span-2 pt-2 border-t border-white/5 space-y-2">
16051605
<div className="flex items-center justify-between mb-1">
16061606
<div className={`text-[10px] font-bold uppercase tracking-wider ${subtleText} opacity-80`}>

src/components/ProteinViewer.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useRef, useImperativeHandle, forwardRef } from 'react';
22
import clsx from 'clsx';
33
import { Skeleton } from './Skeleton';
4-
import type { RepresentationType, ColoringType, ChainInfo, Measurement, PDBMetadata, CustomColorRule, CustomStyleRule, CustomTransparencyRule, ColorPalette, ResidueInfo, StructureInfo, MeasurementTextColor, AtomInfo, SuperposedStructure, Annotation } from '../types';
4+
import type { RepresentationType, ColoringType, ChainInfo, Measurement, CustomColorRule, CustomStyleRule, CustomTransparencyRule, ColorPalette, ResidueInfo, StructureInfo, MeasurementTextColor, AtomInfo, SuperposedStructure, Annotation } from '../types';
55
import { type DataSource, getStructureUrl } from '../utils/pdbUtils';
66

77

@@ -141,9 +141,7 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
141141
customColors = [],
142142
chainStyles = {},
143143
customStyles = [],
144-
setCustomStyles,
145144
customTransparency = [],
146-
setCustomTransparency,
147145
smoothSheetEnabled = false,
148146
overlays,
149147

@@ -2617,15 +2615,15 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
26172615

26182616
// Add the default representation (for non-overridden atoms)
26192617
if (defaultSelection !== "not ()" && defaultSelection !== "none") {
2620-
component.addRepresentation(repType, { ...globalParams, sele: defaultSelection });
2618+
component.addRepresentation(repType as any, { ...globalParams, sele: defaultSelection });
26212619
}
26222620

26232621
// --- 5. RENDER CHAIN-SPECIFIC STYLES ---
26242622
if (chainStyles) {
26252623
Object.entries(chainStyles).forEach(([chain, style]) => {
26262624
if (!style) return;
26272625

2628-
let actualStyle = style;
2626+
let actualStyle = style as any;
26292627
if (actualStyle === 'backbone') actualStyle = 'trace';
26302628
console.log(`[ProteinViewer] Chain ${chain} style: ${style} -> ${actualStyle}`);
26312629

@@ -2646,7 +2644,7 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
26462644
// No overrides - use global defaults
26472645
}
26482646

2649-
component.addRepresentation(actualStyle, chainParams);
2647+
component.addRepresentation(actualStyle as any, chainParams);
26502648
});
26512649
}
26522650

@@ -2657,7 +2655,7 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
26572655
const resPart = rule.residues ? (rule.chain === 'All' ? ` and ${rule.residues}` : ` and ${rule.residues}`) : '';
26582656
const selection = `${chainPart}${resPart}`; // e.g. ":A and 50-60"
26592657

2660-
let actualStyle = rule.style;
2658+
let actualStyle = rule.style as any;
26612659
if (actualStyle === 'backbone') actualStyle = 'trace';
26622660

26632661
const ruleParams: any = {

src/hooks/usePeerSession.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { useEffect, useState, useRef, useCallback } from 'react';
22
import Peer from 'peerjs';
33
import type { DataConnection, MediaConnection } from 'peerjs';
44

5-
import type { ChatMessage } from '../types';
5+
import type { ChatMessage, CustomTransparencyRule } from '../types';
66

77
export interface SessionState {
88
// Single View Props (Legacy/Fallback)
99
pdbId?: string;
1010
representation?: string;
1111
coloring?: string;
1212
customColors?: any[];
13+
customTransparency?: CustomTransparencyRule[];
1314
measurements?: any[];
1415
customBackgroundColor?: string | null;
1516
orientation?: any[];

0 commit comments

Comments
 (0)