Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vwh committed Aug 10, 2024
1 parent ebff874 commit 092251d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/components/settings/settings-sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const RowsPerPageSection: React.FC<RowsPerPageSectionProps> = ({
placeholder="Number of rows"
type="number"
className="w-full"
// Prevent auto-focus when sheet opens
autoFocus={false}
/>
<Button
Expand Down
5 changes: 3 additions & 2 deletions src/components/table/repl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { format } from "sql-formatter";
import CodeMirror from "@uiw/react-codemirror";
import { sql, SQLite } from "@codemirror/lang-sql";
import { autocompletion, CompletionContext } from "@codemirror/autocomplete";
import { nord } from "@uiw/codemirror-theme-nord"; // Import the Nord theme
import { nord } from "@uiw/codemirror-theme-nord";

// SQL Keywords used for autocompletion
const KEYWORDS = [
"SELECT",
"FROM",
Expand Down Expand Up @@ -80,7 +81,7 @@ export default function SqlRepl() {
onChange={handleChange}
onBlur={handleBlur}
className="rounded-md border"
theme={isDark ? nord : "light"} // Apply Nord theme
theme={isDark ? nord : "light"}
/>
);
}
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/usePagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ export function usePagination(rowPerPageOrAuto: "auto" | number) {

const screenHeight = window.innerHeight;

// Base row height calculation
const baseRowHeight = 40; // Minimum row height
const maxRowHeight = 2000; // Maximum row height
const scaleFactor = 0.03; // Adjust this to change how quickly row height increases with screen size
const scaleFactor = 0.03; // how quickly row height increases with screen size

// Calculate adaptive row height
const adaptiveRowHeight = Math.min(
maxRowHeight,
baseRowHeight + screenHeight * scaleFactor
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useQueryData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export function useQueryData(
const tableName = tables[parseInt(selectedTable)].name;
const customResult: QueryExecResult[] = query(
// @ used to represent the current table name
// Just for a shorter query :/
customQuery.replace("@", `"${tableName}"`)
);
const { data, columns } = mapQueryResults(customResult);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getTableSchema = async (database: Database, tableName: string) => {
type: row[2] ? (row[2] as string).toUpperCase() : (row[2] as string),
isPrimaryKey: (row[5] as number) === 1, // 1 means the column is a primary key
isForeignKey: false,
nullable: (row[3] as number) === 0 // 0 means the column is nullable, 1 means it is not nullable
nullable: (row[3] as number) === 0 // 0 means the column is nullable
};
return acc;
},
Expand Down

0 comments on commit 092251d

Please sign in to comment.