Skip to content

Commit

Permalink
Better mobile design
Browse files Browse the repository at this point in the history
  • Loading branch information
tmarti committed Jun 11, 2024
1 parent a272a68 commit 0ab597f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 23 deletions.
30 changes: 22 additions & 8 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ body {
box-sizing: border-box; /* Include padding and border in the element's width */
}

.ConceptRow {
padding: 5px;
}

.ConceptInput {
margin-left: 10px;
}

/* Mobile styles using a media query */
@media (max-width: 600px) { /* Adjust breakpoint as needed */
#main-div {
Expand All @@ -156,18 +164,20 @@ body {
}

#right-pane {
height: calc(100% - 12rem);
height: calc(100% - 10rem);
}

#left-pane {
height: 12rem;
height: 10rem;
padding: 0;
border: unset;
border-bottom: 1px solid lightgrey;
}

.PanelConceptCategories {
width: calc(100% - 2rem);
width: 100%;
padding: 0;
margin: 1rem;
/* margin: 1rem; */
height: 4rem; /* 20% of vertical space */
margin-bottom: 0;
margin-top: 2rem;
Expand All @@ -179,7 +189,7 @@ body {
/* Height auto-adjusts based on content */
padding-bottom: 1rem;
padding: 0;
margin: 1rem;
/* margin: 1rem; */
height: 4rem;
margin-top: 0;
margin-bottom: 1rem;
Expand All @@ -190,20 +200,24 @@ body {
/* flex-grow: 1; */
width: 100%; /* Full width */
height: unset;
border: unset;
}

.HiddenOnMobile {
display: none;
}

.SelectConcept {
max-width: 100%;
padding-left: 5%;
width: 95%;
margin: 0;
}

.ConceptInput {
height: 2rem;
font-size: 20px;
width: 90% !important;
margin-left: 5% !important;
width: 88% !important;
}

.ItemOpenAiKey {
Expand All @@ -220,7 +234,7 @@ body {

.CardHoveredConcept {
position: absolute; /* Fix position relative to the viewport */
bottom: 6rem; /* Align to the top of the viewport */
bottom: 4rem; /* Align to the top of the viewport */
left:50%;
transform: translateX(-50%);
}
Expand Down
11 changes: 9 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ function dist(a: number[], b: number[]) {

function App() {
let [embeddingModel] = useState(new EmbeddingModel());
const [hoveredIndex, setHoveredIndex] = useState(-1);
const [hoveredIndex, _setHoveredIndex] = useState(-1);
const [topIndexes, setTopIndexes] = useState([-1, -1, -1]);
const [concepts, _setConcepts] = useState([] as ConceptDto[]);
const [spherePos, setSpherePos] = useState([0, 0, 0]);

const setHoveredIndex = (value: number) => {
if (concepts[value]) {
alert(concepts[value].description);
}
_setHoveredIndex(value);
};

const fnChangeCustomConcept = async (value: string) => {
const { position } = await embeddingModel.calculateProjection(value);

Expand Down Expand Up @@ -95,7 +102,7 @@ function App() {
<Panel3D
concepts={concepts}
spherePos={spherePos}
onHoverConcept={setHoveredIndex}
onHoverConcept={_setHoveredIndex}
onSelectConcept={setHoveredIndex}/>
</div>
</div>
Expand Down
6 changes: 1 addition & 5 deletions src/ListItemConcept.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const ListItemConcept = ({
disabled: boolean,
}) => {
return (
<div style={{ display: 'flex', alignItems: 'center', padding: '3px' }}>
<div style={{ display: 'flex', alignItems: 'center' }} className="ConceptRow">
<span
className="HiddenOnMobile"
style={{
Expand All @@ -21,12 +21,8 @@ export const ListItemConcept = ({
}}
title={title||""}
/>
&nbsp;
<input
className='ConceptInput'
style={{
width: '180px',
}}
id={inputId}
value={inputValue}
name="test"
Expand Down
14 changes: 6 additions & 8 deletions src/PanelMyConcept.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ export const PanelMyConcept = ({
return (
<div className='PanelMyConcept'>
<h3 style={{textAlign: 'left'}} className='HiddenOnMobile'># Your concept</h3>
<h2>
<ListItemConcept
color='black'
inputId={`prompt-test`}
onChanged={onChangeMyConcept}
disabled={disabled}
/>
</h2>
<ListItemConcept
color='black'
inputId={`prompt-test`}
onChanged={onChangeMyConcept}
disabled={disabled}
/>
<div style={{textAlign: 'center'}} className="HiddenOnMobile">
<button onClick={() => {
onChangeMyConcept(
Expand Down

0 comments on commit 0ab597f

Please sign in to comment.