Skip to content

Commit

Permalink
feat: center map on container
Browse files Browse the repository at this point in the history
  • Loading branch information
samshara committed Apr 12, 2024
1 parent 5567408 commit 8abe1ab
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 154 deletions.
1 change: 0 additions & 1 deletion env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ export default defineConfig({
APP_MAPBOX_ACCESS_TOKEN: Schema.string(),
APP_TITLE: Schema.string(),
APP_GRAPHQL_CODEGEN_ENDPOINT: Schema.string.optional(),
APP_GRAPHQL_ENDPOINT: Schema.string.optional(),
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@graphql-codegen/typescript-operations": "^4.2.0",
"@ifrc-go/icons": "^1.3.3",
"@ifrc-go/ui": "^1.0.0",
"@mapbox/mapbox-gl-draw": "^1.2.0",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@togglecorp/fujs": "^2.1.1",
"@togglecorp/re-map": "^0.2.0-beta-6",
"@togglecorp/toggle-form": "^2.0.4",
Expand Down
3 changes: 2 additions & 1 deletion src/utils/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ export const defaultNavControlPosition: ControlPosition = 'top-right';
export const defaultMapOptions: Omit<mapboxgl.MapboxOptions, 'style' | 'container'> = {
logoPosition: 'bottom-left' as const,
zoom: 1,
minZoom: 1,
minZoom: 0,
maxZoom: 18,
scrollZoom: false,
pitchWithRotate: false,
dragRotate: false,
renderWorldCopies: true,
attributionControl: false,
preserveDrawingBuffer: true,
center: [34, 39],
};

const DEFAULT_CIRCLE_SIZE = 'medium';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type AlertType = NonNullable<NonNullable<NonNullable<AlertInformationsQuery['pub
const alertKeySelector = (item: AlertType) => item.id;
const PAGE_SIZE = 10;

function AlertTable() {
function AlertsTable() {
const strings = useTranslation(i18n);

const {
Expand Down Expand Up @@ -188,4 +188,4 @@ function AlertTable() {
</Container>
);
}
export default AlertTable;
export default AlertsTable;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface Props {
className?: string;
}

function Alerts(props: Props) {
function AlertsView(props: Props) {
const { className } = props;

const strings = useTranslation(i18n);
Expand Down Expand Up @@ -88,4 +88,4 @@ function Alerts(props: Props) {
);
}

export default Alerts;
export default AlertsView;
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.main-content {
display: flex;
flex-grow: 1;
height: 45rem;
gap: var(--go-ui-spacing-md);
height: 45rem;

.alerts-map {
flex-grow: 1;
Expand Down
24 changes: 4 additions & 20 deletions src/views/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { useTranslation } from '@ifrc-go/ui/hooks';

import Page from '#components/Page';

import OngoingAlertMap from './AlertMap';
import Alerts from './Alerts';
import AlertsTable from './AlertsTable';
import AlertsView from './AlertsView';

import i18n from './i18n.json';
import styles from './styles.module.css';
Expand Down Expand Up @@ -44,28 +44,12 @@ export function Component() {
</Tab>
</TabList>
<TabPanel name="map">
<OngoingAlertMap
bbox={undefined}
/>
<AlertsView />
</TabPanel>
<TabPanel name="table">
<AlertTable />
<AlertsTable />
</TabPanel>
</Tabs>
<OngoingAlertMap
bbox={undefined}
/>
<OngoingAlertMap
bbox={undefined}
onActiveCountryChange={setActiveCountryId}
activeCountryId={activeCountryId}
/>
<OngoingAlertMap
bbox={undefined}
onActiveCountryChange={setActiveCountryId}
activeCountryId={activeCountryId}
/>
<Alerts />
</Page>
);
}
Expand Down
Loading

0 comments on commit 8abe1ab

Please sign in to comment.