├── examples └── simple-usage │ ├── src │ ├── react-app-env.d.ts │ ├── App.test.tsx │ ├── index.css │ ├── index.tsx │ ├── App.tsx │ └── serviceWorker.ts │ ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── index.html │ ├── .gitignore │ ├── tsconfig.json │ ├── package.json │ └── README.md ├── jest.config.js ├── tsconfig.json ├── src ├── index.ts ├── useTurkeyCities.test.ts └── cities.ts ├── LICENSE ├── .github └── workflows │ └── main.yml ├── .gitignore ├── package.json └── README.md /examples/simple-usage/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /examples/simple-usage/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /examples/simple-usage/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BatuhanW/use-turkey-cities/HEAD/examples/simple-usage/public/favicon.ico -------------------------------------------------------------------------------- /examples/simple-usage/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BatuhanW/use-turkey-cities/HEAD/examples/simple-usage/public/logo192.png -------------------------------------------------------------------------------- /examples/simple-usage/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BatuhanW/use-turkey-cities/HEAD/examples/simple-usage/public/logo512.png -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: "ts-jest", 3 | testEnvironment: "node", 4 | testPathIgnorePatterns: [ 5 | "/dist/", 6 | "/node_modules/", 7 | "/examples/" 8 | ] 9 | }; 10 | -------------------------------------------------------------------------------- /examples/simple-usage/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /examples/simple-usage/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /examples/simple-usage/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "lib": ["es2017", "es7", "es6", "dom"], 6 | "jsx": "react", 7 | "declaration": true, 8 | "outDir": "./dist", 9 | "rootDir": "./src", 10 | "noImplicitAny": true, 11 | "strictNullChecks": true, 12 | "removeComments": true, 13 | "strict": true, 14 | "esModuleInterop": true 15 | }, 16 | "include": ["src"], 17 | "exclude": ["node_modules", "dist", "examples", "**/*.test.ts"] 18 | } 19 | -------------------------------------------------------------------------------- /examples/simple-usage/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /examples/simple-usage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "noEmit": true, 20 | "jsx": "react" 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /examples/simple-usage/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import CitiesJson, { cities } from "./cities"; 3 | 4 | const useTurkeyCities = () => { 5 | const [city, setCity] = useState("Adana"); 6 | const [districts, setDistricts] = useState([""]); 7 | const [district, setDistrict] = useState(""); 8 | 9 | useEffect(() => { 10 | if (city) { 11 | const _city = CitiesJson[city]; 12 | 13 | if (_city) { 14 | setDistricts(_city.districts); 15 | } 16 | } 17 | }, [city]); 18 | 19 | return { 20 | cities, 21 | city, 22 | setCity, 23 | districts, 24 | district, 25 | setDistrict 26 | }; 27 | }; 28 | 29 | export default useTurkeyCities; 30 | -------------------------------------------------------------------------------- /examples/simple-usage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "simple-usage", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@types/jest": "24.0.23", 7 | "@types/node": "12.12.7", 8 | "@types/react": "16.9.11", 9 | "@types/react-dom": "16.9.4", 10 | "react": "^16.11.0", 11 | "react-dom": "^16.11.0", 12 | "react-scripts": "3.2.0", 13 | "typescript": "3.7.2", 14 | "use-turkey-cities": "^0.1.0" 15 | }, 16 | "scripts": { 17 | "start": "react-scripts start", 18 | "build": "react-scripts build", 19 | "test": "react-scripts test", 20 | "eject": "react-scripts eject" 21 | }, 22 | "eslintConfig": { 23 | "extends": "react-app" 24 | }, 25 | "browserslist": { 26 | "production": [ 27 | ">0.2%", 28 | "not dead", 29 | "not op_mini all" 30 | ], 31 | "development": [ 32 | "last 1 chrome version", 33 | "last 1 firefox version", 34 | "last 1 safari version" 35 | ] 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Batuhan Wilhelm 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the master branch 7 | on: 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 14 | jobs: 15 | # This workflow contains a single job called "build" 16 | build: 17 | # The type of runner that the job will run on 18 | runs-on: ubuntu-latest 19 | 20 | # Steps represent a sequence of tasks that will be executed as part of the job 21 | steps: 22 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 23 | - uses: actions/checkout@v2 24 | 25 | # Runs a single command using the runners shell 26 | - name: Run a one-line script 27 | run: echo Hello, world! 28 | 29 | # Runs a set of commands using the runners shell 30 | - name: Run a multi-line script 31 | run: | 32 | echo Add other actions to build, 33 | echo test, and deploy your project. 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | # dist folder 64 | dist 65 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "use-turkey-cities", 3 | "version": "0.1.1", 4 | "description": "React hook to list Turkey cities and districts", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "scripts": { 8 | "build": "tsc", 9 | "test": "jest --coverage --runInBand", 10 | "prepublish": "tsc" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/BatuhanW/use-turkey-cities.git" 15 | }, 16 | "keywords": [ 17 | "turkey", 18 | "city", 19 | "district", 20 | "hook", 21 | "react", 22 | "javascript" 23 | ], 24 | "author": "BatuhanW ", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/BatuhanW/use-turkey-cities/issues" 28 | }, 29 | "homepage": "https://github.com/BatuhanW/use-turkey-cities#readme", 30 | "devDependencies": { 31 | "@testing-library/react-hooks": "^3.2.1", 32 | "@types/jest": "^24.0.23", 33 | "@types/react": "^16.9.11", 34 | "jest": "^24.9.0", 35 | "react": "^16.0.0", 36 | "react-dom": "^16.0.0", 37 | "react-test-renderer": "^16.11.0", 38 | "ts-jest": "^24.1.0", 39 | "typescript": "^3.7.2" 40 | }, 41 | "peerDependencies": { 42 | "react": "^16.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /examples/simple-usage/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import useTurkeyCities from "use-turkey-cities"; 3 | 4 | const App: React.FC = () => { 5 | const { 6 | cities, 7 | city, 8 | setCity, 9 | districts, 10 | district, 11 | setDistrict 12 | } = useTurkeyCities(); 13 | return ( 14 |
15 |
{ 17 | e.preventDefault(); 18 | console.log(city, districts); 19 | }} 20 | > 21 | 33 |
34 | 46 |
47 | 48 |
49 |
50 | ); 51 | }; 52 | 53 | export default App; 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # List Turkey cities and districts with ease 2 | 3 | You can list cities and after setting `city`, you will get `districts` of corresponding city. 4 | 5 | ### Installing 6 | 7 | ``` 8 | npm i use-turkey-cities 9 | ``` 10 | 11 | or 12 | 13 | ``` 14 | yarn add use-turkey-cities 15 | ``` 16 | 17 | ### Usage 18 | ```tsx 19 | import React from "react"; 20 | import useTurkeyCities from "use-turkey-cities"; 21 | 22 | const App: React.FC = () => { 23 | const { cities, city, setCity, districts, district, setDistrict } = useTurkeyCities(); 24 | 25 | return ( 26 |
27 |
{ 29 | e.preventDefault(); 30 | console.log(city, districts); 31 | }} 32 | > 33 | 45 |
46 | 58 |
59 | 60 |
61 |
62 | ); 63 | }; 64 | 65 | export default App; 66 | 67 | ``` 68 | -------------------------------------------------------------------------------- /examples/simple-usage/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/useTurkeyCities.test.ts: -------------------------------------------------------------------------------- 1 | import useTurkeyCities from "."; 2 | import cities from "./cities"; 3 | import { renderHook, act } from "@testing-library/react-hooks"; 4 | 5 | afterEach(function() { 6 | jest.resetModules(); 7 | }); 8 | 9 | const defaultDistricts = cities["Adana"].districts; 10 | 11 | describe("useTurkeyCities", () => { 12 | it("definitions", () => { 13 | const { 14 | result: { current } 15 | } = renderHook(() => useTurkeyCities()); 16 | 17 | expect(current.cities).toBeDefined(); 18 | 19 | expect(current.city).toBeDefined(); 20 | expect(current.setCity).toBeDefined(); 21 | 22 | expect(current.districts).toBeDefined(); 23 | 24 | expect(current.district).toBeDefined(); 25 | expect(current.setDistrict).toBeDefined(); 26 | }); 27 | 28 | it("cities should list 81 cities", () => { 29 | const { result } = renderHook(() => useTurkeyCities()); 30 | 31 | expect(result.current.cities.length).toBe(81); 32 | }); 33 | 34 | it("should set Adana as default city", () => { 35 | const { result } = renderHook(() => useTurkeyCities()); 36 | 37 | expect(result.current.city).toBe("Adana"); 38 | expect(result.current.districts).toBe(defaultDistricts); 39 | }); 40 | 41 | it("setting correct city", () => { 42 | const { result } = renderHook(() => useTurkeyCities()); 43 | 44 | act(() => { 45 | result.current.setCity("Antalya"); 46 | }); 47 | 48 | expect(result.current.city).toBe("Antalya"); 49 | 50 | expect(result.current.districts).toBe(cities["Antalya"].districts); 51 | }); 52 | 53 | it("setting *empty* city", () => { 54 | const { result } = renderHook(() => useTurkeyCities()); 55 | 56 | act(() => { 57 | result.current.setCity(""); 58 | }); 59 | 60 | expect(result.current.city).toBe(""); 61 | 62 | expect(result.current.districts).toBe(defaultDistricts); 63 | }); 64 | 65 | it("setting *incorrect* city", () => { 66 | const { result } = renderHook(() => useTurkeyCities()); 67 | 68 | act(() => { 69 | result.current.setCity("Random"); 70 | }); 71 | 72 | expect(result.current.city).toBe("Random"); 73 | 74 | expect(result.current.districts).toBe(defaultDistricts); 75 | }); 76 | }); 77 | -------------------------------------------------------------------------------- /examples/simple-usage/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `yarn start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `yarn test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `yarn build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `yarn eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | -------------------------------------------------------------------------------- /examples/simple-usage/src/serviceWorker.ts: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | type Config = { 24 | onSuccess?: (registration: ServiceWorkerRegistration) => void; 25 | onUpdate?: (registration: ServiceWorkerRegistration) => void; 26 | }; 27 | 28 | export function register(config?: Config) { 29 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 30 | // The URL constructor is available in all browsers that support SW. 31 | const publicUrl = new URL( 32 | (process as { env: { [key: string]: string } }).env.PUBLIC_URL, 33 | window.location.href 34 | ); 35 | if (publicUrl.origin !== window.location.origin) { 36 | // Our service worker won't work if PUBLIC_URL is on a different origin 37 | // from what our page is served on. This might happen if a CDN is used to 38 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 39 | return; 40 | } 41 | 42 | window.addEventListener('load', () => { 43 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 44 | 45 | if (isLocalhost) { 46 | // This is running on localhost. Let's check if a service worker still exists or not. 47 | checkValidServiceWorker(swUrl, config); 48 | 49 | // Add some additional logging to localhost, pointing developers to the 50 | // service worker/PWA documentation. 51 | navigator.serviceWorker.ready.then(() => { 52 | console.log( 53 | 'This web app is being served cache-first by a service ' + 54 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 55 | ); 56 | }); 57 | } else { 58 | // Is not localhost. Just register service worker 59 | registerValidSW(swUrl, config); 60 | } 61 | }); 62 | } 63 | } 64 | 65 | function registerValidSW(swUrl: string, config?: Config) { 66 | navigator.serviceWorker 67 | .register(swUrl) 68 | .then(registration => { 69 | registration.onupdatefound = () => { 70 | const installingWorker = registration.installing; 71 | if (installingWorker == null) { 72 | return; 73 | } 74 | installingWorker.onstatechange = () => { 75 | if (installingWorker.state === 'installed') { 76 | if (navigator.serviceWorker.controller) { 77 | // At this point, the updated precached content has been fetched, 78 | // but the previous service worker will still serve the older 79 | // content until all client tabs are closed. 80 | console.log( 81 | 'New content is available and will be used when all ' + 82 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 83 | ); 84 | 85 | // Execute callback 86 | if (config && config.onUpdate) { 87 | config.onUpdate(registration); 88 | } 89 | } else { 90 | // At this point, everything has been precached. 91 | // It's the perfect time to display a 92 | // "Content is cached for offline use." message. 93 | console.log('Content is cached for offline use.'); 94 | 95 | // Execute callback 96 | if (config && config.onSuccess) { 97 | config.onSuccess(registration); 98 | } 99 | } 100 | } 101 | }; 102 | }; 103 | }) 104 | .catch(error => { 105 | console.error('Error during service worker registration:', error); 106 | }); 107 | } 108 | 109 | function checkValidServiceWorker(swUrl: string, config?: Config) { 110 | // Check if the service worker can be found. If it can't reload the page. 111 | fetch(swUrl) 112 | .then(response => { 113 | // Ensure service worker exists, and that we really are getting a JS file. 114 | const contentType = response.headers.get('content-type'); 115 | if ( 116 | response.status === 404 || 117 | (contentType != null && contentType.indexOf('javascript') === -1) 118 | ) { 119 | // No service worker found. Probably a different app. Reload the page. 120 | navigator.serviceWorker.ready.then(registration => { 121 | registration.unregister().then(() => { 122 | window.location.reload(); 123 | }); 124 | }); 125 | } else { 126 | // Service worker found. Proceed as normal. 127 | registerValidSW(swUrl, config); 128 | } 129 | }) 130 | .catch(() => { 131 | console.log( 132 | 'No internet connection found. App is running in offline mode.' 133 | ); 134 | }); 135 | } 136 | 137 | export function unregister() { 138 | if ('serviceWorker' in navigator) { 139 | navigator.serviceWorker.ready.then(registration => { 140 | registration.unregister(); 141 | }); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /src/cities.ts: -------------------------------------------------------------------------------- 1 | interface CitiesJsonInterface { 2 | [key: string]: { 3 | code: number; 4 | districts: string[]; 5 | }; 6 | } 7 | 8 | const CitiesJson: CitiesJsonInterface = { 9 | Adana: { 10 | code: 1, 11 | districts: [ 12 | "Aladağ", 13 | "Ceyhan", 14 | "Çukurova", 15 | "Feke", 16 | "İmamoğlu", 17 | "Karaisalı", 18 | "Karataş", 19 | "Kozan", 20 | "Pozantı", 21 | "Saimbeyli", 22 | "Sarıçam", 23 | "Seyhan", 24 | "Tufanbeyli", 25 | "Yumurtalık", 26 | "Yüreğir" 27 | ] 28 | }, 29 | Adıyaman: { 30 | code: 2, 31 | districts: [ 32 | "Besni", 33 | "Çelikhan", 34 | "Gerger", 35 | "Gölbaşı", 36 | "Kahta", 37 | "Merkez", 38 | "Samsat", 39 | "Sincik", 40 | "Tut" 41 | ] 42 | }, 43 | Afyonkarahisar: { 44 | code: 3, 45 | districts: [ 46 | "Başmakçı", 47 | "Bayat", 48 | "Bolvadin", 49 | "Çay", 50 | "Çobanlar", 51 | "Dazkırı", 52 | "Dinar", 53 | "Emirdağ", 54 | "Evciler", 55 | "Hocalar", 56 | "İhsaniye", 57 | "İscehisar", 58 | "Kızılören", 59 | "Merkez", 60 | "Sandıklı", 61 | "Sinanpaşa", 62 | "Sultandağı", 63 | "Şuhut" 64 | ] 65 | }, 66 | Ağrı: { 67 | code: 4, 68 | districts: [ 69 | "Diyadin", 70 | "Doğubayazıt", 71 | "Eleşkirt", 72 | "Hamur", 73 | "Merkez", 74 | "Patnos", 75 | "Taşlıçay", 76 | "Tutak" 77 | ] 78 | }, 79 | Amasya: { 80 | code: 5, 81 | districts: [ 82 | "Göynücek", 83 | "Gümüşhacıköy", 84 | "Hamamözü", 85 | "Merkez", 86 | "Merzifon", 87 | "Suluova", 88 | "Taşova" 89 | ] 90 | }, 91 | Ankara: { 92 | code: 6, 93 | districts: [ 94 | "Altındağ", 95 | "Ayaş", 96 | "Bala", 97 | "Beypazarı", 98 | "Çamlıdere", 99 | "Çankaya", 100 | "Çubuk", 101 | "Elmadağ", 102 | "Güdül", 103 | "Haymana", 104 | "Kalecik", 105 | "Kızılcahamam", 106 | "Nallıhan", 107 | "Polatlı", 108 | "Şereflikoçhisar", 109 | "Yenimahalle", 110 | "Gölbaşı", 111 | "Keçiören", 112 | "Mamak", 113 | "Sincan", 114 | "Kazan", 115 | "Akyurt", 116 | "Etimesgut", 117 | "Evren", 118 | "Pursaklar" 119 | ] 120 | }, 121 | Antalya: { 122 | code: 7, 123 | districts: [ 124 | "Akseki", 125 | "Alanya", 126 | "Elmalı", 127 | "Finike", 128 | "Gazipaşa", 129 | "Gündoğmuş", 130 | "Kaş", 131 | "Korkuteli", 132 | "Kumluca", 133 | "Manavgat", 134 | "Serik", 135 | "Demre", 136 | "İbradı", 137 | "Kemer", 138 | "Aksu", 139 | "Döşemealtı", 140 | "Kepez", 141 | "Konyaaltı", 142 | "Muratpaşa" 143 | ] 144 | }, 145 | Artvin: { 146 | code: 8, 147 | districts: [ 148 | "Ardanuç", 149 | "Arhavi", 150 | "Merkez", 151 | "Borçka", 152 | "Hopa", 153 | "Şavşat", 154 | "Yusufeli", 155 | "Murgul" 156 | ] 157 | }, 158 | Aydın: { 159 | code: 9, 160 | districts: [ 161 | "Merkez", 162 | "Bozdoğan", 163 | "Efeler", 164 | "Çine", 165 | "Germencik", 166 | "Karacasu", 167 | "Koçarlı", 168 | "Kuşadası", 169 | "Kuyucak", 170 | "Nazilli", 171 | "Söke", 172 | "Sultanhisar", 173 | "Yenipazar", 174 | "Buharkent", 175 | "İncirliova", 176 | "Karpuzlu", 177 | "Köşk", 178 | "Didim" 179 | ] 180 | }, 181 | Balıkesir: { 182 | code: 10, 183 | districts: [ 184 | "Altıeylül", 185 | "Ayvalık", 186 | "Merkez", 187 | "Balya", 188 | "Bandırma", 189 | "Bigadiç", 190 | "Burhaniye", 191 | "Dursunbey", 192 | "Edremit", 193 | "Erdek", 194 | "Gönen", 195 | "Havran", 196 | "İvrindi", 197 | "Karesi", 198 | "Kepsut", 199 | "Manyas", 200 | "Savaştepe", 201 | "Sındırgı", 202 | "Gömeç", 203 | "Susurluk", 204 | "Marmara" 205 | ] 206 | }, 207 | Bilecik: { 208 | code: 11, 209 | districts: [ 210 | "Merkez", 211 | "Bozüyük", 212 | "Gölpazarı", 213 | "Osmaneli", 214 | "Pazaryeri", 215 | "Söğüt", 216 | "Yenipazar", 217 | "İnhisar" 218 | ] 219 | }, 220 | Bingöl: { 221 | code: 12, 222 | districts: [ 223 | "Merkez", 224 | "Genç", 225 | "Karlıova", 226 | "Kiğı", 227 | "Solhan", 228 | "Adaklı", 229 | "Yayladere", 230 | "Yedisu" 231 | ] 232 | }, 233 | Bitlis: { 234 | code: 13, 235 | districts: [ 236 | "Adilcevaz", 237 | "Ahlat", 238 | "Merkez", 239 | "Hizan", 240 | "Mutki", 241 | "Tatvan", 242 | "Güroymak" 243 | ] 244 | }, 245 | Bolu: { 246 | code: 14, 247 | districts: [ 248 | "Merkez", 249 | "Gerede", 250 | "Göynük", 251 | "Kıbrıscık", 252 | "Mengen", 253 | "Mudurnu", 254 | "Seben", 255 | "Dörtdivan", 256 | "Yeniçağa" 257 | ] 258 | }, 259 | Burdur: { 260 | code: 15, 261 | districts: [ 262 | "Ağlasun", 263 | "Bucak", 264 | "Merkez", 265 | "Gölhisar", 266 | "Tefenni", 267 | "Yeşilova", 268 | "Karamanlı", 269 | "Kemer", 270 | "Altınyayla", 271 | "Çavdır", 272 | "Çeltikçi" 273 | ] 274 | }, 275 | Bursa: { 276 | code: 16, 277 | districts: [ 278 | "Gemlik", 279 | "İnegöl", 280 | "İznik", 281 | "Karacabey", 282 | "Keles", 283 | "Mudanya", 284 | "Mustafakemalpaşa", 285 | "Orhaneli", 286 | "Orhangazi", 287 | "Yenişehir", 288 | "Büyükorhan", 289 | "Harmancık", 290 | "Nilüfer", 291 | "Osmangazi", 292 | "Yıldırım", 293 | "Gürsu", 294 | "Kestel" 295 | ] 296 | }, 297 | Çanakkale: { 298 | code: 17, 299 | districts: [ 300 | "Ayvacık", 301 | "Bayramiç", 302 | "Biga", 303 | "Bozcaada", 304 | "Çan", 305 | "Merkez", 306 | "Eceabat", 307 | "Ezine", 308 | "Gelibolu", 309 | "Gökçeada", 310 | "Lapseki", 311 | "Yenice" 312 | ] 313 | }, 314 | Çankırı: { 315 | code: 18, 316 | districts: [ 317 | "Merkez", 318 | "Çerkeş", 319 | "Eldivan", 320 | "Ilgaz", 321 | "Kurşunlu", 322 | "Orta", 323 | "Şabanözü", 324 | "Yapraklı", 325 | "Atkaracalar", 326 | "Kızılırmak", 327 | "Bayramören", 328 | "Korgun" 329 | ] 330 | }, 331 | Çorum: { 332 | code: 19, 333 | districts: [ 334 | "Alaca", 335 | "Bayat", 336 | "Merkez", 337 | "İskilip", 338 | "Kargı", 339 | "Mecitözü", 340 | "Ortaköy", 341 | "Osmancık", 342 | "Sungurlu", 343 | "Boğazkale", 344 | "Uğurludağ", 345 | "Dodurga", 346 | "Laçin", 347 | "Oğuzlar" 348 | ] 349 | }, 350 | Denizli: { 351 | code: 20, 352 | districts: [ 353 | "Acıpayam", 354 | "Buldan", 355 | "Çal", 356 | "Çameli", 357 | "Çardak", 358 | "Çivril", 359 | "Merkez", 360 | "Merkezefendi", 361 | "Pamukkale", 362 | "Güney", 363 | "Kale", 364 | "Sarayköy", 365 | "Tavas", 366 | "Babadağ", 367 | "Bekilli", 368 | "Honaz", 369 | "Serinhisar", 370 | "Baklan", 371 | "Beyağaç", 372 | "Bozkurt" 373 | ] 374 | }, 375 | Diyarbakır: { 376 | code: 21, 377 | districts: [ 378 | "Kocaköy", 379 | "Çermik", 380 | "Çınar", 381 | "Çüngüş", 382 | "Dicle", 383 | "Ergani", 384 | "Hani", 385 | "Hazro", 386 | "Kulp", 387 | "Lice", 388 | "Silvan", 389 | "Eğil", 390 | "Bağlar", 391 | "Kayapınar", 392 | "Sur", 393 | "Yenişehir", 394 | "Bismil" 395 | ] 396 | }, 397 | Edirne: { 398 | code: 22, 399 | districts: [ 400 | "Merkez", 401 | "Enez", 402 | "Havsa", 403 | "İpsala", 404 | "Keşan", 405 | "Lalapaşa", 406 | "Meriç", 407 | "Uzunköprü", 408 | "Süloğlu" 409 | ] 410 | }, 411 | Elazığ: { 412 | code: 23, 413 | districts: [ 414 | "Ağın", 415 | "Baskil", 416 | "Merkez", 417 | "Karakoçan", 418 | "Keban", 419 | "Maden", 420 | "Palu", 421 | "Sivrice", 422 | "Arıcak", 423 | "Kovancılar", 424 | "Alacakaya" 425 | ] 426 | }, 427 | Erzincan: { 428 | code: 24, 429 | districts: [ 430 | "Çayırlı", 431 | "Merkez", 432 | "İliç", 433 | "Kemah", 434 | "Kemaliye", 435 | "Refahiye", 436 | "Tercan", 437 | "Üzümlü", 438 | "Otlukbeli" 439 | ] 440 | }, 441 | Erzurum: { 442 | code: 25, 443 | districts: [ 444 | "Aşkale", 445 | "Çat", 446 | "Hınıs", 447 | "Horasan", 448 | "İspir", 449 | "Karayazı", 450 | "Narman", 451 | "Oltu", 452 | "Olur", 453 | "Pasinler", 454 | "Şenkaya", 455 | "Tekman", 456 | "Tortum", 457 | "Karaçoban", 458 | "Uzundere", 459 | "Pazaryolu", 460 | "Köprüköy", 461 | "Palandöken", 462 | "Yakutiye", 463 | "Aziziye" 464 | ] 465 | }, 466 | Eskişehir: { 467 | code: 26, 468 | districts: [ 469 | "Çifteler", 470 | "Mahmudiye", 471 | "Mihalıççık", 472 | "Sarıcakaya", 473 | "Seyitgazi", 474 | "Sivrihisar", 475 | "Alpu", 476 | "Beylikova", 477 | "İnönü", 478 | "Günyüzü", 479 | "Han", 480 | "Mihalgazi", 481 | "Odunpazarı", 482 | "Tepebaşı" 483 | ] 484 | }, 485 | Gaziantep: { 486 | code: 27, 487 | districts: [ 488 | "Araban", 489 | "İslahiye", 490 | "Nizip", 491 | "Oğuzeli", 492 | "Yavuzeli", 493 | "Şahinbey", 494 | "Şehitkamil", 495 | "Karkamış", 496 | "Nurdağı" 497 | ] 498 | }, 499 | Giresun: { 500 | code: 28, 501 | districts: [ 502 | "Alucra", 503 | "Bulancak", 504 | "Dereli", 505 | "Espiye", 506 | "Eynesil", 507 | "Merkez", 508 | "Görele", 509 | "Keşap", 510 | "Şebinkarahisar", 511 | "Tirebolu", 512 | "Piraziz", 513 | "Yağlıdere", 514 | "Çamoluk", 515 | "Çanakçı", 516 | "Doğankent", 517 | "Güce" 518 | ] 519 | }, 520 | Gümüşhane: { 521 | code: 29, 522 | districts: ["Merkez", "Kelkit", "Şiran", "Torul", "Köse", "Kürtün"] 523 | }, 524 | Hakkari: { 525 | code: 30, 526 | districts: ["Çukurca", "Merkez", "Şemdinli", "Yüksekova"] 527 | }, 528 | Hatay: { 529 | code: 31, 530 | districts: [ 531 | "Altınözü", 532 | "Arsuz", 533 | "Defne", 534 | "Dörtyol", 535 | "Hassa", 536 | "Antakya", 537 | "İskenderun", 538 | "Kırıkhan", 539 | "Payas", 540 | "Reyhanlı", 541 | "Samandağ", 542 | "Yayladağı", 543 | "Erzin", 544 | "Belen", 545 | "Kumlu" 546 | ] 547 | }, 548 | Isparta: { 549 | code: 32, 550 | districts: [ 551 | "Atabey", 552 | "Eğirdir", 553 | "Gelendost", 554 | "Merkez", 555 | "Keçiborlu", 556 | "Senirkent", 557 | "Sütçüler", 558 | "Şarkikaraağaç", 559 | "Uluborlu", 560 | "Yalvaç", 561 | "Aksu", 562 | "Gönen", 563 | "Yenişarbademli" 564 | ] 565 | }, 566 | Mersin: { 567 | code: 33, 568 | districts: [ 569 | "Anamur", 570 | "Erdemli", 571 | "Gülnar", 572 | "Mut", 573 | "Silifke", 574 | "Tarsus", 575 | "Aydıncık", 576 | "Bozyazı", 577 | "Çamlıyayla", 578 | "Akdeniz", 579 | "Mezitli", 580 | "Toroslar", 581 | "Yenişehir" 582 | ] 583 | }, 584 | İstanbul: { 585 | code: 34, 586 | districts: [ 587 | "Adalar", 588 | "Bakırköy", 589 | "Beşiktaş", 590 | "Beykoz", 591 | "Beyoğlu", 592 | "Çatalca", 593 | "Eyüp", 594 | "Fatih", 595 | "Gaziosmanpaşa", 596 | "Kadıköy", 597 | "Kartal", 598 | "Sarıyer", 599 | "Silivri", 600 | "Şile", 601 | "Şişli", 602 | "Üsküdar", 603 | "Zeytinburnu", 604 | "Büyükçekmece", 605 | "Kağıthane", 606 | "Küçükçekmece", 607 | "Pendik", 608 | "Ümraniye", 609 | "Bayrampaşa", 610 | "Avcılar", 611 | "Bağcılar", 612 | "Bahçelievler", 613 | "Güngören", 614 | "Maltepe", 615 | "Sultanbeyli", 616 | "Tuzla", 617 | "Esenler", 618 | "Arnavutköy", 619 | "Ataşehir", 620 | "Başakşehir", 621 | "Beylikdüzü", 622 | "Çekmeköy", 623 | "Esenyurt", 624 | "Sancaktepe", 625 | "Sultangazi" 626 | ] 627 | }, 628 | İzmir: { 629 | code: 35, 630 | districts: [ 631 | "Aliağa", 632 | "Bayındır", 633 | "Bergama", 634 | "Bornova", 635 | "Çeşme", 636 | "Dikili", 637 | "Foça", 638 | "Karaburun", 639 | "Karşıyaka", 640 | "Kemalpaşa", 641 | "Kınık", 642 | "Kiraz", 643 | "Menemen", 644 | "Ödemiş", 645 | "Seferihisar", 646 | "Selçuk", 647 | "Tire", 648 | "Torbalı", 649 | "Urla", 650 | "Beydağ", 651 | "Buca", 652 | "Konak", 653 | "Menderes", 654 | "Balçova", 655 | "Çiğli", 656 | "Gaziemir", 657 | "Narlıdere", 658 | "Güzelbahçe", 659 | "Bayraklı", 660 | "Karabağlar" 661 | ] 662 | }, 663 | Kars: { 664 | code: 36, 665 | districts: [ 666 | "Arpaçay", 667 | "Digor", 668 | "Kağızman", 669 | "Merkez", 670 | "Sarıkamış", 671 | "Selim", 672 | "Susuz", 673 | "Akyaka" 674 | ] 675 | }, 676 | Kastamonu: { 677 | code: 37, 678 | districts: [ 679 | "Abana", 680 | "Araç", 681 | "Azdavay", 682 | "Bozkurt", 683 | "Cide", 684 | "Çatalzeytin", 685 | "Daday", 686 | "Devrekani", 687 | "İnebolu", 688 | "Merkez", 689 | "Küre", 690 | "Taşköprü", 691 | "Tosya", 692 | "İhsangazi", 693 | "Pınarbaşı", 694 | "Şenpazar", 695 | "Ağlı", 696 | "Doğanyurt", 697 | "Hanönü", 698 | "Seydiler" 699 | ] 700 | }, 701 | Kayseri: { 702 | code: 38, 703 | districts: [ 704 | "Bünyan", 705 | "Develi", 706 | "Felahiye", 707 | "İncesu", 708 | "Pınarbaşı", 709 | "Sarıoğlan", 710 | "Sarız", 711 | "Tomarza", 712 | "Yahyalı", 713 | "Yeşilhisar", 714 | "Akkışla", 715 | "Talas", 716 | "Kocasinan", 717 | "Melikgazi", 718 | "Hacılar", 719 | "Özvatan" 720 | ] 721 | }, 722 | Kırklareli: { 723 | code: 39, 724 | districts: [ 725 | "Babaeski", 726 | "Demirköy", 727 | "Merkez", 728 | "Kofçaz", 729 | "Lüleburgaz", 730 | "Pehlivanköy", 731 | "Pınarhisar", 732 | "Vize" 733 | ] 734 | }, 735 | Kırşehir: { 736 | code: 40, 737 | districts: [ 738 | "Çiçekdağı", 739 | "Kaman", 740 | "Merkez", 741 | "Mucur", 742 | "Akpınar", 743 | "Akçakent", 744 | "Boztepe" 745 | ] 746 | }, 747 | Kocaeli: { 748 | code: 41, 749 | districts: [ 750 | "Gebze", 751 | "Gölcük", 752 | "Kandıra", 753 | "Karamürsel", 754 | "Körfez", 755 | "Derince", 756 | "Başiskele", 757 | "Çayırova", 758 | "Darıca", 759 | "Dilovası", 760 | "İzmit", 761 | "Kartepe" 762 | ] 763 | }, 764 | Konya: { 765 | code: 42, 766 | districts: [ 767 | "Akşehir", 768 | "Beyşehir", 769 | "Bozkır", 770 | "Cihanbeyli", 771 | "Çumra", 772 | "Doğanhisar", 773 | "Ereğli", 774 | "Hadim", 775 | "Ilgın", 776 | "Kadınhanı", 777 | "Karapınar", 778 | "Kulu", 779 | "Sarayönü", 780 | "Seydişehir", 781 | "Yunak", 782 | "Akören", 783 | "Altınekin", 784 | "Derebucak", 785 | "Hüyük", 786 | "Karatay", 787 | "Meram", 788 | "Selçuklu", 789 | "Taşkent", 790 | "Ahırlı", 791 | "Çeltik", 792 | "Derbent", 793 | "Emirgazi", 794 | "Güneysınır", 795 | "Halkapınar", 796 | "Tuzlukçu", 797 | "Yalıhüyük" 798 | ] 799 | }, 800 | Kütahya: { 801 | code: 43, 802 | districts: [ 803 | "Altıntaş", 804 | "Domaniç", 805 | "Emet", 806 | "Gediz", 807 | "Merkez", 808 | "Simav", 809 | "Tavşanlı", 810 | "Aslanapa", 811 | "Dumlupınar", 812 | "Hisarcık", 813 | "Şaphane", 814 | "Çavdarhisar", 815 | "Pazarlar" 816 | ] 817 | }, 818 | Malatya: { 819 | code: 44, 820 | districts: [ 821 | "Akçadağ", 822 | "Arapgir", 823 | "Arguvan", 824 | "Darende", 825 | "Doğanşehir", 826 | "Hekimhan", 827 | "Merkez", 828 | "Pütürge", 829 | "Yeşilyurt", 830 | "Battalgazi", 831 | "Doğanyol", 832 | "Kale", 833 | "Kuluncak", 834 | "Yazıhan" 835 | ] 836 | }, 837 | Manisa: { 838 | code: 45, 839 | districts: [ 840 | "Akhisar", 841 | "Alaşehir", 842 | "Demirci", 843 | "Gördes", 844 | "Kırkağaç", 845 | "Kula", 846 | "Merkez", 847 | "Salihli", 848 | "Sarıgöl", 849 | "Saruhanlı", 850 | "Selendi", 851 | "Soma", 852 | "Şehzadeler", 853 | "Yunusemre", 854 | "Turgutlu", 855 | "Ahmetli", 856 | "Gölmarmara", 857 | "Köprübaşı" 858 | ] 859 | }, 860 | Kahramanmaraş: { 861 | code: 46, 862 | districts: [ 863 | "Afşin", 864 | "Andırın", 865 | "Dulkadiroğlu", 866 | "Onikişubat", 867 | "Elbistan", 868 | "Göksun", 869 | "Merkez", 870 | "Pazarcık", 871 | "Türkoğlu", 872 | "Çağlayancerit", 873 | "Ekinözü", 874 | "Nurhak" 875 | ] 876 | }, 877 | Mardin: { 878 | code: 47, 879 | districts: [ 880 | "Derik", 881 | "Kızıltepe", 882 | "Artuklu", 883 | "Merkez", 884 | "Mazıdağı", 885 | "Midyat", 886 | "Nusaybin", 887 | "Ömerli", 888 | "Savur", 889 | "Dargeçit", 890 | "Yeşilli" 891 | ] 892 | }, 893 | Muğla: { 894 | code: 48, 895 | districts: [ 896 | "Bodrum", 897 | "Datça", 898 | "Fethiye", 899 | "Köyceğiz", 900 | "Marmaris", 901 | "Menteşe", 902 | "Milas", 903 | "Ula", 904 | "Yatağan", 905 | "Dalaman", 906 | "Seydikemer", 907 | "Ortaca", 908 | "Kavaklıdere" 909 | ] 910 | }, 911 | Muş: { 912 | code: 49, 913 | districts: ["Bulanık", "Malazgirt", "Merkez", "Varto", "Hasköy", "Korkut"] 914 | }, 915 | Nevşehir: { 916 | code: 50, 917 | districts: [ 918 | "Avanos", 919 | "Derinkuyu", 920 | "Gülşehir", 921 | "Hacıbektaş", 922 | "Kozaklı", 923 | "Merkez", 924 | "Ürgüp", 925 | "Acıgöl" 926 | ] 927 | }, 928 | Niğde: { 929 | code: 51, 930 | districts: ["Bor", "Çamardı", "Merkez", "Ulukışla", "Altunhisar", "Çiftlik"] 931 | }, 932 | Ordu: { 933 | code: 52, 934 | districts: [ 935 | "Akkuş", 936 | "Altınordu", 937 | "Aybastı", 938 | "Fatsa", 939 | "Gölköy", 940 | "Korgan", 941 | "Kumru", 942 | "Mesudiye", 943 | "Perşembe", 944 | "Ulubey", 945 | "Ünye", 946 | "Gülyalı", 947 | "Gürgentepe", 948 | "Çamaş", 949 | "Çatalpınar", 950 | "Çaybaşı", 951 | "İkizce", 952 | "Kabadüz", 953 | "Kabataş" 954 | ] 955 | }, 956 | Rize: { 957 | code: 53, 958 | districts: [ 959 | "Ardeşen", 960 | "Çamlıhemşin", 961 | "Çayeli", 962 | "Fındıklı", 963 | "İkizdere", 964 | "Kalkandere", 965 | "Pazar", 966 | "Merkez", 967 | "Güneysu", 968 | "Derepazarı", 969 | "Hemşin", 970 | "İyidere" 971 | ] 972 | }, 973 | Sakarya: { 974 | code: 54, 975 | districts: [ 976 | "Akyazı", 977 | "Geyve", 978 | "Hendek", 979 | "Karasu", 980 | "Kaynarca", 981 | "Sapanca", 982 | "Kocaali", 983 | "Pamukova", 984 | "Taraklı", 985 | "Ferizli", 986 | "Karapürçek", 987 | "Söğütlü", 988 | "Adapazarı", 989 | "Arifiye", 990 | "Erenler", 991 | "Serdivan" 992 | ] 993 | }, 994 | Samsun: { 995 | code: 55, 996 | districts: [ 997 | "Alaçam", 998 | "Bafra", 999 | "Çarşamba", 1000 | "Havza", 1001 | "Kavak", 1002 | "Ladik", 1003 | "Terme", 1004 | "Vezirköprü", 1005 | "Asarcık", 1006 | "Ondokuzmayıs", 1007 | "Salıpazarı", 1008 | "Tekkeköy", 1009 | "Ayvacık", 1010 | "Yakakent", 1011 | "Atakum", 1012 | "Canik", 1013 | "İlkadım" 1014 | ] 1015 | }, 1016 | Siirt: { 1017 | code: 56, 1018 | districts: [ 1019 | "Baykan", 1020 | "Eruh", 1021 | "Kurtalan", 1022 | "Pervari", 1023 | "Merkez", 1024 | "Şirvan", 1025 | "Tillo" 1026 | ] 1027 | }, 1028 | Sinop: { 1029 | code: 57, 1030 | districts: [ 1031 | "Ayancık", 1032 | "Boyabat", 1033 | "Durağan", 1034 | "Erfelek", 1035 | "Gerze", 1036 | "Merkez", 1037 | "Türkeli", 1038 | "Dikmen", 1039 | "Saraydüzü" 1040 | ] 1041 | }, 1042 | Sivas: { 1043 | code: 58, 1044 | districts: [ 1045 | "Divriği", 1046 | "Gemerek", 1047 | "Gürün", 1048 | "Hafik", 1049 | "İmranlı", 1050 | "Kangal", 1051 | "Koyulhisar", 1052 | "Merkez", 1053 | "Suşehri", 1054 | "Şarkışla", 1055 | "Yıldızeli", 1056 | "Zara", 1057 | "Akıncılar", 1058 | "Altınyayla", 1059 | "Doğanşar", 1060 | "Gölova", 1061 | "Ulaş" 1062 | ] 1063 | }, 1064 | Tekirdağ: { 1065 | code: 59, 1066 | districts: [ 1067 | "Çerkezköy", 1068 | "Çorlu", 1069 | "Ergene", 1070 | "Hayrabolu", 1071 | "Malkara", 1072 | "Muratlı", 1073 | "Saray", 1074 | "Süleymanpaşa", 1075 | "Kapaklı", 1076 | "Şarköy", 1077 | "Marmaraereğlisi" 1078 | ] 1079 | }, 1080 | Tokat: { 1081 | code: 60, 1082 | districts: [ 1083 | "Almus", 1084 | "Artova", 1085 | "Erbaa", 1086 | "Niksar", 1087 | "Reşadiye", 1088 | "Merkez", 1089 | "Turhal", 1090 | "Zile", 1091 | "Pazar", 1092 | "Yeşilyurt", 1093 | "Başçiftlik", 1094 | "Sulusaray" 1095 | ] 1096 | }, 1097 | Trabzon: { 1098 | code: 61, 1099 | districts: [ 1100 | "Akçaabat", 1101 | "Araklı", 1102 | "Arsin", 1103 | "Çaykara", 1104 | "Maçka", 1105 | "Of", 1106 | "Ortahisar", 1107 | "Sürmene", 1108 | "Tonya", 1109 | "Vakfıkebir", 1110 | "Yomra", 1111 | "Beşikdüzü", 1112 | "Şalpazarı", 1113 | "Çarşıbaşı", 1114 | "Dernekpazarı", 1115 | "Düzköy", 1116 | "Hayrat", 1117 | "Köprübaşı" 1118 | ] 1119 | }, 1120 | Tunceli: { 1121 | code: 62, 1122 | districts: [ 1123 | "Çemişgezek", 1124 | "Hozat", 1125 | "Mazgirt", 1126 | "Nazımiye", 1127 | "Ovacık", 1128 | "Pertek", 1129 | "Pülümür", 1130 | "Merkez" 1131 | ] 1132 | }, 1133 | Şanlıurfa: { 1134 | code: 63, 1135 | districts: [ 1136 | "Akçakale", 1137 | "Birecik", 1138 | "Bozova", 1139 | "Ceylanpınar", 1140 | "Eyyübiye", 1141 | "Halfeti", 1142 | "Haliliye", 1143 | "Hilvan", 1144 | "Karaköprü", 1145 | "Siverek", 1146 | "Suruç", 1147 | "Viranşehir", 1148 | "Harran" 1149 | ] 1150 | }, 1151 | Uşak: { 1152 | code: 64, 1153 | districts: ["Banaz", "Eşme", "Karahallı", "Sivaslı", "Ulubey", "Merkez"] 1154 | }, 1155 | Van: { 1156 | code: 65, 1157 | districts: [ 1158 | "Başkale", 1159 | "Çatak", 1160 | "Erciş", 1161 | "Gevaş", 1162 | "Gürpınar", 1163 | "İpekyolu", 1164 | "Muradiye", 1165 | "Özalp", 1166 | "Tuşba", 1167 | "Bahçesaray", 1168 | "Çaldıran", 1169 | "Edremit", 1170 | "Saray" 1171 | ] 1172 | }, 1173 | Yozgat: { 1174 | code: 66, 1175 | districts: [ 1176 | "Akdağmadeni", 1177 | "Boğazlıyan", 1178 | "Çayıralan", 1179 | "Çekerek", 1180 | "Sarıkaya", 1181 | "Sorgun", 1182 | "Şefaatli", 1183 | "Yerköy", 1184 | "Merkez", 1185 | "Aydıncık", 1186 | "Çandır", 1187 | "Kadışehri", 1188 | "Saraykent", 1189 | "Yenifakılı" 1190 | ] 1191 | }, 1192 | Zonguldak: { 1193 | code: 67, 1194 | districts: ["Çaycuma", "Devrek", "Ereğli", "Merkez", "Alaplı", "Gökçebey"] 1195 | }, 1196 | Aksaray: { 1197 | code: 68, 1198 | districts: [ 1199 | "Ağaçören", 1200 | "Eskil", 1201 | "Gülağaç", 1202 | "Güzelyurt", 1203 | "Merkez", 1204 | "Ortaköy", 1205 | "Sarıyahşi" 1206 | ] 1207 | }, 1208 | Bayburt: { code: 69, districts: ["Merkez", "Aydıntepe", "Demirözü"] }, 1209 | Karaman: { 1210 | code: 70, 1211 | districts: [ 1212 | "Ermenek", 1213 | "Merkez", 1214 | "Ayrancı", 1215 | "Kazımkarabekir", 1216 | "Başyayla", 1217 | "Sarıveliler" 1218 | ] 1219 | }, 1220 | Kırıkkale: { 1221 | code: 71, 1222 | districts: [ 1223 | "Delice", 1224 | "Keskin", 1225 | "Merkez", 1226 | "Sulakyurt", 1227 | "Bahşili", 1228 | "Balışeyh", 1229 | "Çelebi", 1230 | "Karakeçili", 1231 | "Yahşihan" 1232 | ] 1233 | }, 1234 | Batman: { 1235 | code: 72, 1236 | districts: ["Merkez", "Beşiri", "Gercüş", "Kozluk", "Sason", "Hasankeyf"] 1237 | }, 1238 | Şırnak: { 1239 | code: 73, 1240 | districts: [ 1241 | "Beytüşşebap", 1242 | "Cizre", 1243 | "İdil", 1244 | "Silopi", 1245 | "Merkez", 1246 | "Uludere", 1247 | "Güçlükonak" 1248 | ] 1249 | }, 1250 | Bartın: { 1251 | code: 74, 1252 | districts: ["Merkez", "Kurucaşile", "Ulus", "Amasra"] 1253 | }, 1254 | Ardahan: { 1255 | code: 75, 1256 | districts: ["Merkez", "Çıldır", "Göle", "Hanak", "Posof", "Damal"] 1257 | }, 1258 | Iğdır: { 1259 | code: 76, 1260 | districts: ["Aralık", "Merkez", "Tuzluca", "Karakoyunlu"] 1261 | }, 1262 | Yalova: { 1263 | code: 77, 1264 | districts: [ 1265 | "Merkez", 1266 | "Altınova", 1267 | "Armutlu", 1268 | "Çınarcık", 1269 | "Çiftlikköy", 1270 | "Termal" 1271 | ] 1272 | }, 1273 | Karabük: { 1274 | code: 78, 1275 | districts: [ 1276 | "Eflani", 1277 | "Eskipazar", 1278 | "Merkez", 1279 | "Ovacık", 1280 | "Safranbolu", 1281 | "Yenice" 1282 | ] 1283 | }, 1284 | Kilis: { 1285 | code: 79, 1286 | districts: ["Merkez", "Elbeyli", "Musabeyli", "Polateli"] 1287 | }, 1288 | Osmaniye: { 1289 | code: 80, 1290 | districts: [ 1291 | "Bahçe", 1292 | "Kadirli", 1293 | "Merkez", 1294 | "Düziçi", 1295 | "Hasanbeyli", 1296 | "Sumbas", 1297 | "Toprakkale" 1298 | ] 1299 | }, 1300 | Düzce: { 1301 | code: 81, 1302 | districts: [ 1303 | "Akçakoca", 1304 | "Merkez", 1305 | "Yığılca", 1306 | "Cumayeri", 1307 | "Gölyaka", 1308 | "Çilimli", 1309 | "Gümüşova", 1310 | "Kaynaşlı" 1311 | ] 1312 | } 1313 | }; 1314 | 1315 | export const cities = Object.keys(CitiesJson); 1316 | 1317 | export default CitiesJson; 1318 | --------------------------------------------------------------------------------